Hi,

I am very new to Python and have run into the following problem. If I do
something like

  dir = os.listdir(somepath)
  for d in dir:
     print d
                
The program fails for filenames that contain non-ascii characters.

  'ascii' codec can't encode characters in position 33-34:

I have noticed that this seems to be a very common problem. I have read a lot
of postings regarding it but not really found a solution. Is there a simple
one?

What I specifically do not understand is why Python wants to interpret the
string as ASCII at all. Where is this setting hidden?

I am running Python 2.3.4 on Windows XP and I want to run the program on
Debian sarge later.

Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"There is a procedure to follow in these cases, and if followed it can
 pretty well guarantee a generous measure of success, success here
 defined as survival with major extremities remaining attached."
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to