[Python-3000] [Python-Dev] New proposition for Python3 bytes filename issue
Terry Reedy
tjreedy at udel.edu
Tue Sep 30 19:29:01 CEST 2008
Guido van Rossum wrote:
> On Mon, Sep 29, 2008 at 8:55 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>>> Le Monday 29 September 2008 19:06:01 Guido van Rossum, vous avez écrit :
>>>> I know I keep flipflopping on this one, but the more I think about it
>>>> the more I believe it is better to drop those names than to raise an
>>>> exception. Otherwise a "naive" program that happens to use
>>>> os.listdir() can be rendered completely useless by a single non-UTF-8
>>>> filename. Consider the use of os.listdir() by the glob module. If I am
>>>> globbing for *.py, why should the presence of a file named b'\xff'
>>>> cause it to fail?
>> To avoid silent skipping, is it possible to drop 'unreadable' names, issue a
>> warning (instead of exception), and continue to completion?
>> "Warning: unreadable filename skipped; see PyWiki/UnreadableFilenames"
>
> That would be annoying as hell in most cases.
OK. Put one warning in the docs at the top of OS/Files and Directories:
Note: On Unix, illegal filenames (and the files they name) are silently
ignored by many of the functions below.
-- but perhaps with more specific info, such as what is illegal, which
functions, and how to fix outside of Python.
> I consider the dropping of unreadable names similar to the suppression
> of "hidden" files by various operating systems.
That is documented, sometimes annoying, and reversible when it is.
Python should at least document doing something similar.
tjr
More information about the Python-3000
mailing list