This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ubershmekel, vstinner
Date 2011-10-25.19:51:27
SpamBayes Score 0.0025673087
Marked as misclassified No
Message-id <>
os.getcwdb() (GetCurrentDirectoryA) and os.listdir(bytes) (FindNextFileA & co) encode filenames using WideCharToMultiByte() in default mode (flags=0): unencodable characters are replaced by question marks. Such filenames cannot be used, open() fails with OSError(22, "invalid argument: '?'") for example.

Attached patch changes os.getcwdb() and os.listdir(bytes) to use the Windows native API (wide character API) with Python MBCS codec in strict mode (error handler "strict") to notify directly the user that the filename cannot be decoded.

The patch only changes the behaviour for filename not encodable to the ANSI code page, such filenames are rare.
Date User Action Args
2011-10-25 19:51:30vstinnersetrecipients: + vstinner, ubershmekel
2011-10-25 19:51:30vstinnersetmessageid: <>
2011-10-25 19:51:29vstinnerlinkissue13247 messages
2011-10-25 19:51:29vstinnercreate