Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

2012-12-07 Thread iMath
mdb.escape_string(img)) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte so how to fix it ? Python 3 distinguishes between binary data and Unicode text. Trying to apply string functions to images or other binary data won't work. Maybe

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

2012-12-06 Thread iMath
\py32\itest4.py, line 20, in module mdb.escape_string(img)) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte so how to fix it ? -- http://mail.python.org/mailman/listinfo/python-list

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

2012-12-06 Thread Terry Reedy
it to python 3 ,and also change fin = open(chrome.png) to fin = open(Chrome_Logo.png,'rb') but when I run it ,it gives the following error : Traceback (most recent call last): File E:\Python\py32\itest4.py, line 20, in module mdb.escape_string(img)) UnicodeDecodeError: 'utf-8' codec can't decode

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

2012-12-06 Thread Hans Mulder
\itest4.py, line 20, in module mdb.escape_string(img)) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte so how to fix it ? Python 3 distinguishes between binary data and Unicode text. Trying to apply string functions to images or other binary data

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

2012-12-06 Thread Steven D'Aprano
mdb.escape_string(img)) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte so how to fix it ? I suggest you start by reading the documentation for MySQLdb.escape_string. What does it do? What does it expect? A byte string or a unicode text string? It seems very