Is errno.ENOENT the right value?

Mike Thompson n/a
Mon May 12 22:30:28 EDT 2003


I've reduced my problem to the following few lines.
(BTW, there is no path "c:\path" on my system):


C:\Mike>python
ActivePython 2.2.2 Build 224 (ActiveState Corp.) based on
Python 2.2.2 (#37, Nov 26 2002, 10:24:37) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, errno
>>> try:
...     l = os.listdir('c:\path')
... except os.error, error:
...     if (error.errno != errno.ENOENT):
...         raise
...
Traceback (most recent call last):
  File "<stdin>", line 2, in ?
WindowsError: [Errno 3] The system cannot find the path specified:
'c:\\path/*.*'

My question is:  why does 'error.errno' have the value 3?  Given that the path
does not exist, I had expect it to have the value errno.ENOENT (2), in which
case no exception would have been raised?

>>>  errno.errorcode[error.errno]
'ESRCH'

Any help much appreciated.  I must be missing something very easy, but I can't
for the life of me see it.

--
Mike








More information about the Python-list mailing list