odd unicode error

"Martin v. Löwis" martin at v.loewis.de
Thu Apr 12 14:38:19 EDT 2007


>     path += '/' + b
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 1:
> ordinal not in range(128)
> 
> Any ideas?

path is a Unicode string, b is a byte string and contains the
byte \xd0.

The problem is that you have a directory with file names in it that
cannot be converted to Unicode strings, using the file system
encoding. If you can't fix the file system, you have to make
search_path a byte string.

Regards,
Martin



More information about the Python-list mailing list