Encoding of file names
__peter__ at web.de
Thu Dec 8 16:17:59 CET 2005
> I am trying to programatically access files created on an IBM AIX
> system, stored on a Sun OS 5.8 fileserver, through a samba-mapped drive
> on a Win32 system. Not confused? OK, let's move on... ;-)
> When I ask for an os.listdir() of a relevant directory, I get filenames
> with embedded escaped characters (ex.
> which will read as "False" when applying an os.path.isfile() to it. I
> wish to apply some operations to these files, but am unable, since
> python (on Win32, at least) does not recognize this as a valid
Does the problem persist if you feed os.listdir() a unicode path?
This will cause listdir() to return unicode filenames which are less prone
to encoding confusion.
More information about the Python-list