Bug in python (Weird UnicodeDecodeError)
dbri.tcc at gmail.com
dbri.tcc at gmail.com
Tue Dec 13 16:14:29 EST 2005
Hello
I am getting somewhat random UnicodeDecodeError messages in my program.
It is random in that I will be going through a pysqlite database of
records, manipulate
the results, and it will throw UnicodeDecodeError apparently without
regard
as to what data is being used.
For example I am reading in some book barcodes. These are 7 digit
strings. It processes a few thousand of these with no problem. But then
parway through the database results I get something like this:
for item in list:
UnicodeDecodeError : 'utf8' codec can't decode bytes in position 26-28:
invalid data
I am not quite sure how u'2349350' is 26 bytes long. Maybe it is. But
another time it said something like 'position 129'.
Furthermore when I rearrange the order the database data is retrieved
(with Order By), it barfs on a different piece of data than it did
before. I cannot figure it out.
I thought at first it was the eval() function being loopy, so I wrote
my own 'evalfix' function that handled the limited set of data i was
using. Then the thing barfed in a completely different spot.
And then I added more data to the database, and it barfed it yet a new
spot.
Any help is appreciated, thanks.
More information about the Python-list
mailing list