Thursday, 15 August 2013

python - UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 11: invalid start byte -


I am trying to write data in excel sheet using UTF-8 encoding. With full traceback ->

  traceback (the most recent call last), I get the following error: The file "C: \ user \ varun \ Desktop \ Python_testfiles \" Automation report \ Txnkpy ", line 142, & lt; module & gt; Domesticsheet.write (row, J., Tiaksan [Peyuaid] [j]) file" C: \ Python 27 \ BB \ site-packages \ Xlwt \ Worksheet " Line 1030, write yourself. (R). Write (c, label, style) file "C: \ Python 27 \ \ site \ packages \ xlwt \ Row.py", line 240, write The trail (self .__ idx, col, style_index, self .__ parent_wb.add_str (label)) The file "C: \ Python27 \ lib \ site-package \ xlwt \ Workbook.py", line 326, add_str return itself .__ Sstkadd_str (s) file "C: \ Python27 \ lib \ site-packages \ xlwt \ BIFFRecords .py", line 24, add_str s = Unicode (s, self.encoding) UnicodeDecodeError: 'in UTF8' codec position 11 Byte 0x80 can not decode: invalid start byte  

The main issue is that I get this error randomly. I ran the code for data compared to some other day and it was just fine. I tried to use utf-16 "and" ascii "instead of encoding instead of utf-8, but the error persists (error statement has changed, though.)

is there any way to I can get rid of this error? Besides, I would like to know why this error occurs (I'm starting in Python). We would appreciate any kind of help. Will it also provide some encoding types? Required?

if It follows you see code ->

  filehandler [booknumber] = xlwt.Workbook (encoding = "utf-8") domesticsheet = filehandler [booknumber] .add_sheet ( "Domestic_txn" + `booknumber`, cell_overwrite_ok = true) in Jammu and Kashmir (lane (for the header)): domesticsheet.write (0, k, header [k]) range; (LAN (Tiaksan [Peyyud]): domesticsheet.write (Line, j, txn [drinkooid] [j])  

No comments:

Post a Comment