pyExcelerator bug?

T

tkpmep

My program creates three lists: the first has dates expressed as
strings, the second has floats that are strictly positive, and the
third has floats that are strictly negative. I have no trouble writing
the data in these lists to a .csv file using the csv module using the
following code.

outfile = file(fn + '.csv','wb')
writer = csv.writer(outfile)
for i in range(len(dateList)):
writer.writerow([dateList, posVals, negVals])
outfile.close()

However, when I try to write to an Excel file using pyExcelerator (see
code below), the third list is not always written correctly - my
program sometimes writes positive numbers into the third column of the
spreadsheet. Is this a known bug? if so, is there a workaround? Is
pyExcelerator being developed any longer? My attempts to reach the
developer have gone nowhere.

w = pyExcelerator.Workbook()
ws = w.add_sheet(fn + p)
for i,d in enumerate(dateList):
ws.write(i+1, 0, dateList)
ws.write(i+1, 1, posVals)
ws.write(i+1, 2, negVals)
w.save(fn+'.xls')

Sincerely

Thomas Philps
 
W

Waldemar Osuch

My program creates three lists: the first has dates expressed as
strings, the second has floats that are strictly positive, and the
third has floats that are strictly negative. I have no trouble writing
the data in these lists to a .csv file using the csv module using the
following code.

outfile = file(fn + '.csv','wb')
writer = csv.writer(outfile)
for i in range(len(dateList)):
writer.writerow([dateList, posVals, negVals])
outfile.close()

However, when I try to write to an Excel file usingpyExcelerator(see
code below), the third list is not always written correctly - my
program sometimes writes positive numbers into the third column of the
spreadsheet. Is this a known bug? if so, is there a workaround? IspyExceleratorbeing developed any longer? My attempts to reach the
developer have gone nowhere.

w =pyExcelerator.Workbook()
ws = w.add_sheet(fn + p)
for i,d in enumerate(dateList):
ws.write(i+1, 0, dateList)
ws.write(i+1, 1, posVals)
ws.write(i+1, 2, negVals)
w.save(fn+'.xls')

Sincerely

Thomas Philps


Try using this patch on Cell.py and see if it fixes your problem:



--- Cell.py (revision 4522)
+++ Cell.py (revision 4523)

@@ -101,6 +101,14 @@


def get_biff_data(self):
+ return BIFFRecords.NumberRecord(self.__parent.get_index(),
self.__idx, self.__xf_idx, self.__number).get()
+ # Skipping all the logic below.
+ # From what I understand it tries to save space.
+ # Unfortunately it gets it wrong and produces false results.
+ # For example:
+ # 814289000 gets written out as -259452824
+
 
J

John Machin

My program creates three lists: the first has dates expressed as
strings, the second has floats that are strictly positive, and the
third has floats that are strictly negative. I have no trouble writing
the data in these lists to a .csv file using the csv module using the
following code.

outfile = file(fn + '.csv','wb')
writer = csv.writer(outfile)
for i in range(len(dateList)):
writer.writerow([dateList, posVals, negVals])
outfile.close()

However, when I try to write to an Excel file usingpyExcelerator(see
code below), the third list is not always written correctly - my
program sometimes writes positive numbers into the third column of the
spreadsheet. Is this a known bug?


[looks like my (earlier) reply to the original post didn't make it to
c.l.py]

This may well be a manifestation of the RK bug that is reported in two
bug reports (1509223 and 1596642) on the pyExcelerator sourceforge site.
However it is impossible to tell for sure, as the OP has supplied
neither an executable demonstration script nor any
actual-versus-expected numbers.

Yes. In fact there are three:
(1) An avoid-the-problem patch (doesn't create RK records), like Waldemar's.
(2) A patch that corrects the pyExcelerator code -- see patch number
1618443 on the pyExcelerator sourceforge site.
(3) A fix that creates RK records more efficiently than (2) -- see
"xlwt" below.

(1) There seems to be sporadic activity on the pyExcelerator sourceforge
site.

(2) I am maintaining xlwt (i.e. Excel write), a fork of pyExcelerator --
fixed known and unknown bugs, improved performance, and made it run
under Python 2.3. Available from
https://secure.simplistix.co.uk/svn/xlwt/trunk

See also http://groups.google.com/group/python-excel
w =pyExcelerator.Workbook()
ws = w.add_sheet(fn + p)
for i,d in enumerate(dateList):
ws.write(i+1, 0, dateList)
ws.write(i+1, 1, posVals)
ws.write(i+1, 2, negVals)
w.save(fn+'.xls')


Try using this patch on Cell.py and see if it fixes your problem:



--- Cell.py (revision 4522)
+++ Cell.py (revision 4523)

@@ -101,6 +101,14 @@


def get_biff_data(self):
+ return BIFFRecords.NumberRecord(self.__parent.get_index(),
self.__idx, self.__xf_idx, self.__number).get()
+ # Skipping all the logic below.
+ # From what I understand it tries to save space.
+ # Unfortunately it gets it wrong and produces false results.
+ # For example:
+ # 814289000 gets written out as -259452824
+



Cheers,
John
 
T

tkpmep

John,

I'd be delighted to try xlwt (does it work under Python 2.4 and 2.5?)
I followed the link to ...svn/xlwt/trunk and found a collection of
files, but no Windows installer. How do I install xlwt?

Thanks in advance

Thomas Philips
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top