Unicode Decode Error

Ian Kelly ian.g.kelly at gmail.com
Fri Oct 8 18:59:19 EDT 2010


On Fri, Oct 8, 2010 at 3:31 PM, Pratik Khemka <pratikkhemka at hotmail.com>wrote:

>  *UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position
> 152: ordinal not in range(128)*. Can someone please help me with  this
> error
> The error occurs in line *wbk.save(p4_merge.xls)*. I have used *
> import xlwt*..Can someone just tell what do I need to do to get rid of
> this error. I read other forums which explain the error but do not solve it.
> Thanks in advance..
>
>
You're writing non-ascii data to the workbook, which is then trying to
decode it using the default ascii encoding, which will fail.  When you
create the workbook, you need to specify the correct encoding, e.g.:

wbk = xlwt.Workbook('utf-8')

or whatever encoding you're actually using.

Cheers,
Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101008/7dd39464/attachment-0001.html>


More information about the Python-list mailing list