July 12th, 2005, 03:57 PM
using os.walk with directories with unicode names
How do I get os.walk to see directories like
CombiNumeralsΦ 4.0 (T1)
noodle script ƒ
When I try to walk over these on windows it barfs saying something like
OSError: [Errno 2] No such file or directory: 'TT fonts 2\\CombiNumeralsF 4.0 (T1)'
So it doesn't see the directory as it's really named. Is there a flag or setting I can set to have it work with those names?
Ok it turns out just the 'Φ' gives it a fit. This character has thus far given me trouble with getting it to be seen properly. os.path.supports_unicode_filenames returns true so things like that second example directory is being seen properly.
I guess I need to convert path names into the old style dos paths to get things to work right 100% of the time since I can't do much about locking out directories named weirdly.