Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-10-01 Thread Guido van Rossum
On Wed, Oct 1, 2008 at 1:05 AM, Simon Cross <[EMAIL PROTECTED]> wrote: > On Wed, Oct 1, 2008 at 12:04 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: >> Plus, even on Linux Unicode is *usually* what you should be doing, >> unless you're writing a backup tool. > > I still find this line of reasoning

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-10-01 Thread Stephen J. Turnbull
Simon Cross writes: > a) There is some chance that at least ASCII characters will be > displayed correctly if getfilesystemencoding() is similar to the > encoding used and corrupted filenames will display correctly except > for corrupted characters. All you're saying is that the cases *you* c

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-10-01 Thread Simon Cross
On Wed, Oct 1, 2008 at 12:25 PM, Stephen J. Turnbull <[EMAIL PROTECTED]> wrote: > Simon Cross writes: > > > I still find this line of reasoning a bit worrying. Imagine an end > > user application like a music player. The user discovers that he can't > > see some .mp3 or .ogg file from the music

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-10-01 Thread Stephen J. Turnbull
Simon Cross writes: > I still find this line of reasoning a bit worrying. Imagine an end > user application like a music player. The user discovers that he can't > see some .mp3 or .ogg file from the music player that is visibile is > the file manager. I would expect him to file a bug on the m

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-10-01 Thread Simon Cross
On Wed, Oct 1, 2008 at 12:04 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Plus, even on Linux Unicode is *usually* what you should be doing, > unless you're writing a backup tool. I still find this line of reasoning a bit worrying. Imagine an end user application like a music player. The user

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-10-01 Thread Simon Cross
On Wed, Oct 1, 2008 at 12:05 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Actually on Windows the syscalls use the encoding that Microsoft uses > -- when using bytes we use the Windows bytes API and when using str we > use the Windows wide API. That's the most platform-compatible > approach.

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread Guido van Rossum
On Tue, Sep 30, 2008 at 12:07 PM, Simon Cross <[EMAIL PROTECTED]> wrote: > On Tue, Sep 30, 2008 at 7:56 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: >> (since os.getcwdb() is a Unix-only thing). > > I would be happier if all the Unix byte functions existed on Windows > fell back to something lik

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread Guido van Rossum
On Tue, Sep 30, 2008 at 11:47 AM, <[EMAIL PROTECTED]> wrote: > > On 05:56 pm, [EMAIL PROTECTED] wrote: >> >> On Tue, Sep 30, 2008 at 10:59 AM, <[EMAIL PROTECTED]> wrote: >>> >>> On 02:32 pm, [EMAIL PROTECTED] wrote: > >>> In the absence of a 2.6 getcwdb, perhaps the fixer could just drop the >>>

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread Simon Cross
On Tue, Sep 30, 2008 at 7:56 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > (since os.getcwdb() is a Unix-only thing). I would be happier if all the Unix byte functions existed on Windows fell back to something like encoding the filenames to/from UTF-8. Then at least it would be possible for pr

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread glyph
On 05:56 pm, [EMAIL PROTECTED] wrote: On Tue, Sep 30, 2008 at 10:59 AM, <[EMAIL PROTECTED]> wrote: On 02:32 pm, [EMAIL PROTECTED] wrote: In the absence of a 2.6 getcwdb, perhaps the fixer could just drop the "benefit of the doubt" case? It could always be added to 2.7, and the parity relea

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread Guido van Rossum
On Tue, Sep 30, 2008 at 10:59 AM, <[EMAIL PROTECTED]> wrote: > On 02:32 pm, [EMAIL PROTECTED] wrote: >> If 2.6 weren't pretty much released already I'd ask to add >> os.getcwdb() there, as an alias for os.getcwd(), and add a 2to3 fixer >> that converts os.getcwdu() to os.getcwd(), leaves os.getcwd

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread glyph
On 02:32 pm, [EMAIL PROTECTED] wrote: On Tue, Sep 30, 2008 at 6:21 AM, <[EMAIL PROTECTED]> wrote: On 12:47 am, [EMAIL PROTECTED] wrote: It sounds like maybe there should be some 2to3 fixers in here somewhere, too? Not necessarily as part of this patch, but somewhere related? I don't know

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread Bill Janssen
Victor Stinner <[EMAIL PROTECTED]> wrote: > - listdir(unicode) -> only unicode, *skip* invalid filenames >(as asked by Guido) Is there an option listdir(bytes) which will return *all* filenames (as byte sequences)? Otherwise, this seems troubling to me; *something* should be returned for f

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread Guido van Rossum
On Tue, Sep 30, 2008 at 6:21 AM, <[EMAIL PROTECTED]> wrote: > On 12:47 am, [EMAIL PROTECTED] wrote: > > This is the most sane contribution I've seen so far :). Thanks. I'll review it later today (after coffee+breakfast :) and will apply it assuming the code is reasonably sane, otherwise I'll go a

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread Victor Stinner
Hi, > This is the most sane contribution I've seen so far :). Oh thanks. > Do I understand properly that (listdir(bytes) -> bytes)? Yes, os.listdir(bytes)->bytes. It's already the current behaviour. But with Python3 trunk, os.listdir(str) -> str ... or bytes (if unicode conversion fails). >

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-30 Thread glyph
On 12:47 am, [EMAIL PROTECTED] wrote: This is the most sane contribution I've seen so far :). See attached patch: python3_bytes_filename.patch Using the patch, you will get: - open() support bytes - listdir(unicode) -> only unicode, *skip* invalid filenames (as asked by Guido) Forgive me fo

Re: [Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-29 Thread Brett Cannon
On Mon, Sep 29, 2008 at 5:47 PM, Victor Stinner <[EMAIL PROTECTED]> wrote: > Hi, > > See attached patch: python3_bytes_filename.patch > Patches should go on the tracker, not the mailing list. Otherwise it will just get lost. -Brett ___ Python-Dev mailin

[Python-Dev] Patch for an initial support of bytes filename in Python3

2008-09-29 Thread Victor Stinner
Hi, See attached patch: python3_bytes_filename.patch Using the patch, you will get: - open() support bytes - listdir(unicode) -> only unicode, *skip* invalid filenames (as asked by Guido) - remove os.getcwdu() - create os.getcwdb() -> bytes - glob.glob() support bytes - fnmatch.filter()