"Martin v. Löwis" wrote:
>> My goal is to build generalized code that consistently works with all
>> kinds of filenames.
>
> Then it is best to drop the notion that file names are
> character strings (because some file names aren't). You
> do so by converting your path variable into a byte
> string. To do that, you could try
>
> path = path.encode(sys.getfilesystemencoding())

Shouldn't os.path.join do that? If you pass a unicode string
and a byte string it currently tries to convert bytes to characters
but it makes more sense to convert the unicode string to bytes
and return two byte strings concatenated.

  Serge.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to