New submission from Manuel de la Pena <man...@canonical.com>: During the development of an application that needed to write paths longer than 260 chars we opted to use \\?\ as per http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath.
When working with literal paths the following the os.listdir funtion would return the following trace: >>> import os >>> test = r'\\?\C:\Python27' >>> os.listdir(test) Traceback (most recent call last): File "<stdin>", line 1, in <module> WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: '\\\\?\\C:\\Python27/*.*' The reason for this is that the implementation of listdir appends '/' at the end of the path if os.path.sep is not present at the end of it which FindFirstFile does not like. This is a inconsistency from the OS but it can be easily fixed (see attached patch). ---------- components: Library (Lib) files: listdir.patch keywords: patch messages: 146031 nosy: mandel priority: normal severity: normal status: open title: os.listdir breaks with literal paths versions: Python 2.7 Added file: http://bugs.python.org/file23482/listdir.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