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 glchapman
Recipients
Date 2002-04-03.17:10:52
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
With the current Win32 build (actually, 2.2.1c1), you 
get the following behavior when feeding bad filenames 
to Python's open function:

>>> open("hello?.txt")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: invalid argument: r

Apparently, VC6 maps the Win32 error 
ERROR_INVALID_NAME to EINVAL, and Python always treats 
this error as being related to the mode string.  It 
appears (from bug report 476593) that VC6 disagrees 
with GCC here; I don't know which compiler is right 
(actually, looking at the VC documentation for _open, 
it appears GCC is right).  At any rate, it appears 
Python cannot rely on EINVAL referring only to the 
mode string under Windows.

Interestingly, the current Python Win32 build also 
shows this:

>>> open("hello.txt", "x")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 0] Error: 'hello.txt'

When you actually provide a bad mode string, fopen 
fails, but it does not set errno.  (You can see this 
in the openfile function in _OPEN.C in the VC6 CRT 
source).  It might be possible to use this behavior to 
produce more accurate error messages under Windows.

History
Date User Action Args
2007-08-23 14:00:21adminlinkissue538827 messages
2007-08-23 14:00:21admincreate