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 benjamin.peterson
Recipients HWJ, amaury.forgeotdarc, benjamin.peterson, gvanrossum, pitrou, vstinner
Date 2008-08-21.23:35:51
SpamBayes Score 9.858003e-12
Marked as misclassified No
Message-id <1afaf6160808211635u7646decfx59382760312ca619@mail.gmail.com>
In-reply-to <1219361518.85.0.279111555392.issue3187@psf.upfronthosting.co.za>
Content
On Thu, Aug 21, 2008 at 6:31 PM, Guido van Rossum
<report@bugs.python.org> wrote:
>
> Guido van Rossum <guido@python.org> added the comment:
>
> So shutil should be fixed to pass a bytes value to os.listdir().  But
> then os.remove() should be fixed to accept bytes as well.  This is the
> crux I believe: on Unix at least, syscall wrappers should accept bytes
> for filenames.  And this would then have to be extended to things like
> the functions in os.path, and we'd need bytes versions of os.sep and
> os.altsep...  This sounds like a good project for 3.1.
>
> I do not accept an os.listdir() that raises an error because one
> filename cannot be decoded.  It sounds like using errors='replace' is
> also wrong -- so the only solution is for os.listdir() to skip files it
> cannot decode.  While this doesn't help for rmtree(), it is better than
> errors='replace' for code that descends into the tree looking for files
> matching a pattern or other property.  So I propose this as a patch for 3.0.

As much as this maybe the right idea, I don't like the idea of
silently losing the contents of a directory. That's asking for
difficult to discover bugs. Could Python emit a warning in this case?
>
> The callback variant is too complex; you could write it yourself by
> using os.listdir() with a bytes argument.  This also applies to
> proposals like passing optional encoding and errors arguments to
> os.listdir().
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue3187>
> _______________________________________
>
History
Date User Action Args
2008-08-21 23:35:52benjamin.petersonsetrecipients: + benjamin.peterson, gvanrossum, amaury.forgeotdarc, pitrou, vstinner, HWJ
2008-08-21 23:35:51benjamin.petersonlinkissue3187 messages
2008-08-21 23:35:51benjamin.petersoncreate