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 ezio.melotti, ishimoto, loewis, tim.golden, vstinner
Date 2012-07-25.08:17:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343204255.55.0.363445520738.issue15441@psf.upfronthosting.co.za>
In-reply-to
Content
> If a file name was invalid byte character, os.chdir() raises
> UnicodeDecodeError() instead of WindowsError.

I realized that the problem is in the error handling: raising the OSError fails with a UnicodeDecodeError because PyErr_SetFromWindowsErrWithFilename() calls PyUnicode_DecodeFSDefault(), whereas the filename is not decodable. If you want to change something, it should be PyErr_SetFromWindowsErrWithFilename(). We may use PyObject_Repr() or PyObject_ASCII() for example.

--

See also the issue #13374: "The Windows bytes API has been deprecated in the os module. Use Unicode filenames instead of bytes filenames to not depend on the ANSI code page anymore and to support any filename."
History
Date User Action Args
2012-07-25 08:17:35vstinnersetrecipients: + vstinner, loewis, ishimoto, tim.golden, ezio.melotti
2012-07-25 08:17:35vstinnersetmessageid: <1343204255.55.0.363445520738.issue15441@psf.upfronthosting.co.za>
2012-07-25 08:17:34vstinnerlinkissue15441 messages
2012-07-25 08:17:34vstinnercreate