Message142589
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). |
|
Date |
User |
Action |
Args |
2011-08-21 00:46:30 | pitrou | set | recipients:
+ pitrou, amaury.forgeotdarc, tim.golden, brian.curtin |
2011-08-21 00:46:30 | pitrou | set | messageid: <1313887590.17.0.197838525474.issue12802@psf.upfronthosting.co.za> |
2011-08-21 00:46:29 | pitrou | link | issue12802 messages |
2011-08-21 00:46:29 | pitrou | create | |
|