os.stat UnicodeEncodeError:

S

Sandy Oz

Hello everyone,


I'm running into a problem with file names containing
Unicode chars.

Here is the error that I get when calling os.path.isfile:

File "/usr/lib/python2.6/genericpath.py", line 29, in isfile
st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode characters in
position 38-41: ordinal not in range(128)


I'm working with python2.6, Ubuntu 10.10 running Gnome.

The interesting thing is that I do not get this error when
running the command in the python interpreter (with the same
filename).

Only when I do it through the application I developed.
Shouldn't os module not be using the system locale in both
cases?

I tried setting the locale to en_US.UTF-8 but to no avail.


Thank you,

Sandy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top