[Python-bugs-list] [ python-Bugs-538827 ] Python open w/ MSVC6: bad error msgs
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 03 Apr 2002 09:15:03 -0800
Bugs item #538827, was opened at 2002-04-03 17:10
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=538827&group_id=5470
Category: Python Interpreter Core
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Chapman (glchapman)
>Assigned to: Tim Peters (tim_one)
Summary: Python open w/ MSVC6: bad error msgs
Initial Comment:
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.
----------------------------------------------------------------------
>Comment By: Michael Hudson (mwh)
Date: 2002-04-03 17:15
Message:
Logged In: YES
user_id=6656
Guess who gets to look at this one.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=538827&group_id=5470