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 loewis
Recipients loewis, vstinner
Date 2010-09-12.17:12:17
SpamBayes Score 2.5944365e-08
Marked as misclassified No
Message-id <4C8D09F0.7020901@v.loewis.de>
In-reply-to <1284308329.34.0.00144822719653.issue9820@psf.upfronthosting.co.za>
Content
> You know directly that os.listdir(bytes) is unable to encode the
> filename, instead of manipulate an invalid filename (b'?') and get
> the error later (when you use the filename: open, copy, delete, ...
> the file).

Ok. Then I'm -1 on the patch: you can't know whether the application
actually wants to open the file. Perhaps it only wants to display the
file names, or perhaps it only wants to open some of the files, or
only traverse into subdirectories.

For backwards compatibility, I recommend to leave things as they are.
FindFirst/NextFileA will also do some other interesting conversions,
such as the best-fit conversion (which the "mbcs" code doesn't do
(anymore?)).

Windows has explicit A and W versions, and Python has explicit A
and W types, so it's IMO best to pair them in the natural way
(even if that means code duplication).

> Anywy, on Windows, it's not a good idea to manipulate bytes
> filenames. So it's also a way to encourage people to migrate their
> applications to unicode on Windows.

Only if people run into the issue (which few people will). People
which *do* run into the issue will likely get an error either
way, which will teach them their lesson :-)
History
Date User Action Args
2010-09-12 17:12:20loewissetrecipients: + loewis, vstinner
2010-09-12 17:12:18loewislinkissue9820 messages
2010-09-12 17:12:17loewiscreate