Incorrect error message

Fredrik Lundh effbot at telia.com
Wed Mar 8 21:47:14 CET 2000


gerrit at nl.linux.org wrote:
> >>> open('/tmp/abcde', 'e')
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> IOError: [Errno 22] Invalid argument: '/tmp/abcde'

"open" is a rather thin interface to C's "fopen".

if the "fopen" function fails, for any reason, Python
raises an IOError.

when you print such an exception, it prints the error
code, followed by the error description (as provided
by the operating system library), followed by the file-
name (if known).

in this case, the combination is a bit misleading, but
there's no reasonable way to avoid this.

</F>







More information about the Python-list mailing list