[Python-3000] New proposition for Python3 bytes filename issue
Terry Reedy
tjreedy at udel.edu
Tue Sep 30 22:12:20 CEST 2008
Terry Reedy wrote:
> Guido van Rossum wrote:
>> I'm not sure either way. I've heard it claim that Windows filesystem
>> APIs use Unicode natively. Does Python 3.0 on Windows currently
>> support filenames expressed as bytes? Are they encoded first before
>> passing to the Unicode APIs? Using what encoding?
> [os.listdir(bytes) returns list of bytes, open(bytes) fails]
More:
The path functions seem also do not work:
>>> op.abspath(b'tem')
...
path = path.replace("/", "\\")
TypeError: expected an object with the buffer interface
The error message is a bit cryptic given that the problem is that the
arguments to replace should be bytes instead of strings for a bytes path.
.basename fails with
...
while i and p[i-1] not in '/\\':
TypeError: 'in <string>' requires string as left operand, not int
os.rename, os.stat, os.mkdir, os.rmdir work. I presume same is true for
others that normally work on windows.
tjr
More information about the Python-3000
mailing list