Peter Bienstman schrieb: > UnicodeEncodeError: 'ascii' codec can't encode characters in position 24-29: > ordinal not in range(128) > > I could try encoding the string in utg-8, but then it wouldn't work under > Windows. > > Is there an elegant cross-platform solution for this?
I assume you are using some Unix version here. If so, you should set up the locale correctly. For example, if you set LANG to a UTF-8 locale supported by your operating system, this (passing Unicode strings to os.path.exists etc) works just fine. Python follows the Unix convention that the locale defines how to interpret characters, in particular for file names. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list