os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

Fredrik Lundh fredrik at pythonware.com
Fri Nov 17 01:53:39 EST 2006


gabor wrote:

> get an Unicode-exception, as everywhere else. you see, exceptions are 
> ok, i can deal with them.

> p.s: one additional note. if you code expects os.listdir to return 
> unicode, that usually means that all your code uses unicode strings. 
> which in turn means, that those filenames will somehow later interact 
> with unicode strings. which means that that byte-string-filename will 
> probably get auto-converted to unicode at a later point, and that 
> auto-conversion will VERY probably fail

it will raise an exception, most likely.  didn't you just say that 
exceptions were ok?

</F>




More information about the Python-list mailing list