[Tutor] os.rename anomaly in Python 2.3 on Windows XP

Terry Carroll carroll at tjc.com
Thu Oct 11 02:50:41 CEST 2007


On Tue, 9 Oct 2007, Tony Cappellini wrote:

> Unfortunately,os.listdir() returns the same string as glob.glob, for
> the problem file I mentioned.

Tony --

Try specifying the argument to os.listdir as a unicode string.  I've found
that cures many ailments like this.

e.g., instead of something like:

filelist = os.listdir('.')

use:

filelist = os.listdir(u'.')

I don't think glob supports this.




More information about the Tutor mailing list