Message146338
I'd also like to point out that Unicode path is handled correctly in both 2.7.x
and 3.x:
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir(u'\\\\?\\D:\\Temp\\tempdir')
[u'sub1', u'test1.txt']
>>> os.listdir('\\\\?\\D:\\Temp\\tempdir')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
WindowsError: [Error 123] The filename, directory name, or volume label syntax i
s incorrect: '\\\\?\\D:\\Temp\\tempdir/*.*'
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir('\\\\?\\D:\\Temp\\tempdir')
['sub1', 'test1.txt']
>>> os.listdir(b'\\\\?\\D:\\Temp\\tempdir')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
WindowsError: [Error 123] The filename, directory name, or volume label syntax i
s incorrect: '\\\\?\\D:\\Temp\\tempdir/*.*'
The problem only lies in the code handling narrow string paths. If you look at
(py33) posixmodule.c:2545-6, the bare path is appended with L"\\*.*". Whereas
in the narrow string case, posixmodule.c:2625-6, the bare path is appended with
"/*.*", instead.
To be consistent, we should use '\\'. |
|
Date |
User |
Action |
Args |
2011-10-24 23:33:15 | santoso.wijaya | set | recipients:
+ santoso.wijaya, loewis, pitrou, vstinner, tim.golden, brian.curtin, mandel |
2011-10-24 23:33:14 | santoso.wijaya | set | messageid: <1319499194.97.0.39053741209.issue13234@psf.upfronthosting.co.za> |
2011-10-24 23:33:14 | santoso.wijaya | link | issue13234 messages |
2011-10-24 23:33:14 | santoso.wijaya | create | |
|