"Message file not found"
Siggy Brentrup
bsb at winnegan.de
Sun Dec 26 04:34:20 EST 1999
Stefan Schwarzer <s.schwarzer at ndh.net> writes:
> Hello everybody,
> I use the Python port (1.5.2) for OS/2 (Warp 4) and have the
> following problem: When I type (for example)
> >>> f=open( 'spam', 'r' ) # spam doesn't exist
> I get
>
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> IOError: [Errno 10] Message file not found.: 'spam'
> while on Solaris it reads
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> IOError: [Errno 2] No such file or directory: 'spam'
> Obviously, the (more specific) error messages in OS/2 are not there,
> but so far I couldn't figure out how to "get them".
I'm not sure what you are looking for, obviously on OS/2 the C library
sets errno=10 if a file doesn't exist while all Unix variants I
know of use errno=2 for this purpose.
For portability use the errno module:
Python 1.5.2+ (#4, Nov 18 1999, 01:39:08) [GCC egcs-2.91.66 19990314 (egcs-1.1.2 release)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
IDLE 0.5 -- press F1 for help
>>> import errno
>>> try:
open('spam','r')
except IOError, x:
if x.errno == errno.ENOENT:
print 'Oops'
else: raise
Oops
btw: To get the symbol for an error number use:
>>> errno.errorcode[2]
'ENOENT'
HIH
Siggy
--
Siggy Brentrup - bsb at winnegan.de - http://www.winnegan.de/
****** ceterum censeo javascriptum esse restrictam *******
More information about the Python-list
mailing list