UnicodeDecodeError

Fredrik Lundh fredrik at pythonware.com
Thu May 5 05:12:10 EDT 2005


Thomas Thomas wrote:

> filename=unicode(filename);
> #file = ('file', filename, data) #This won't work will give a
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc7
> in position 10: ordinal not in range(128)

there's no way the tuple creation will generate a UnicodeDecodeError
all by itself.  are you sure the error occurs on that line?

are you running this with a stock interpreter, or are you using some
fancy IDE thing?

what does filename really contain?  (there's no "0xc7" character in the
filepath in your example).  try adding

    print repr(filepath)

before the os.path.split call, and let us know what it prints.

</F>






More information about the Python-list mailing list