pyExcelerator bug?

Waldemar Osuch waldemar.osuch at gmail.com
Sun May 20 17:01:27 EDT 2007


On May 16, 4:42 pm, tkp... at hotmail.com wrote:
> 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[i], posVals[i], negVals[i]])
> 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[i])
>     ws.write(i+1, 1, posVals[i])
>     ws.write(i+1, 2, negVals[i])
> 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
+




More information about the Python-list mailing list