New submission from Anthony Sottile <asott...@umich.edu>: On windows, a deep path can be accessed by prefixing the path with \\?\
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx?f=255&MSPPError=-2147217396#maxpath The call to `listdir()` fails because it uses a posix separator. A quick patch to fix this is to use `SEP` here: https://github.com/python/cpython/blob/ab95b3074ee43098edf3f23b07fb18ef57ee614d/Modules/posixmodule.c#L2388 (I can submit a patch for this) Here's a stacktrace >>> os.listdir(r'\\?\C:\Temp') 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:\\Temp/*.*' This works fine in python3, as the code has been refactored to use `SEP` already. >>> os.listdir(r'\\?\C:\Temp') [] ---------- components: Library (Lib), Windows messages: 309862 nosy: Anthony Sottile, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: os.listdir(...) on deep path on windows in python2.7 fails with errno 123 versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32539> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com