This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients amaury.forgeotdarc, brian.curtin, pitrou, tim.golden
Date 2011-08-21.00:46:29
SpamBayes Score 8.7961715e-05
Marked as misclassified No
Message-id <1313887590.17.0.197838525474.issue12802@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2011-08-21 00:46:30pitrousetrecipients: + pitrou, amaury.forgeotdarc, tim.golden, brian.curtin
2011-08-21 00:46:30pitrousetmessageid: <1313887590.17.0.197838525474.issue12802@psf.upfronthosting.co.za>
2011-08-21 00:46:29pitroulinkissue12802 messages
2011-08-21 00:46:29pitroucreate