ssutee / metageta

Automatically exported from code.google.com/p/metageta
Other
0 stars 0 forks source link

'ascii' codec error when updating an XLS #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
*What steps will reproduce the problem?*
1. Run crawler and generate a new XLS
2. Run crawler over a folder that contains a tif with a non-ascii character
in its metadata, updating the above XLS
3. Profit???

*What is the expected output? What do you see instead?*
UnicodeDecodeError: 'ascii' codec can't decode byte 0x90 in position 87:
ordinal not in range(128)

Original issue reported on code.google.com by pinner.luke@gmail.com on 29 Apr 2010 at 6:22

GoogleCodeExporter commented 9 years ago
xlutils.copy.copy() does not copy the encoding.

>>> from xlutils import xlrd
>>> from xlutils import xlwt
>>> from xlutils.copy import copy
>>> rb=xlrd.open_workbook(some_xls,encoding_override='latin-1')
>>> wb=copy(rb)
>>> print wb.encoding
'ascii'
>>> wb.encoding='latin-1'
>>> print wb.encoding
>>> sh=wb.get_sheet(0)
>>> sh.write(0,0,'\x90')
>>> wb.save(some_other_xls)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x90 in position 0: ordinal 
not
in range(128)

'latin-1'

Original comment by pinner.luke@gmail.com on 29 Apr 2010 at 6:45

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r291.

Original comment by pinner.luke@gmail.com on 30 Apr 2010 at 12:29