Santoso Wijaya <santoso.wij...@gmail.com> added the comment: 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 '\\'. ---------- Added file: http://bugs.python.org/file23512/issue13234_py33.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13234> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com