New submission from Antoine Pitrou <pit...@free.fr>: Windows error 3 is returned when a directory path doesn't exist, but 267 is returned when an existing path is not a directory. This corresponds straight to the definition of ENOTDIR, but Python translates it to EINVAL:
>>> os.listdir("xx") Traceback (most recent call last): File "<stdin>", line 1, in <module> WindowsError: [Error 3] The system cannot find the path specified: 'xx\\*.*' >>> os.listdir("LICENSE") Traceback (most recent call last): File "<stdin>", line 1, in <module> WindowsError: [Error 267] The directory name is invalid: 'LICENSE\\*.*' >>> os.chdir("LICENSE") Traceback (most recent call last): File "<stdin>", line 1, in <module> WindowsError: [Error 267] The directory name is invalid: 'LICENSE' >>> e = sys.last_value >>> e.errno 22 >>> errno.errorcode[22] 'EINVAL' In PC/errmap.h, no Windows error code is translated to ENOTDIR (errno 20). ---------- messages: 142589 nosy: amaury.forgeotdarc, brian.curtin, pitrou, tim.golden priority: normal severity: normal stage: needs patch status: open title: Windows error code 267 should be mapped to ENOTDIR, not EINVAL type: behavior versions: Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12802> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com