Built-in Exceptions - How to Find Out Possible Errno's

Gregory Piñero gregpinero at gmail.com
Wed Jul 5 17:25:50 EDT 2006


Hi Guys,

I'm sure this is documented somewhere, I just can't locate it.  Say I
have this code:

try:
	myfile=file('greg.txt','r')
except IOError, error:
        #now psuedo code because this is what I'm trying to figure out
        if error.errno=='file doesn't exist':
                     do something
        elif error.errno=='no permissions':
                     do something else
... and so on

So basically I'm looking for the document that tells me what possible
errors I can catch and their numbers.

I did find this but it doesn't have numbers and I can't tell if it's
even what I'm looking for:
http://docs.python.org/lib/module-errno.html

Much thanks!

-- 
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)



More information about the Python-list mailing list