[Tutor] error trap
alan.gauld@bt.com
alan.gauld@bt.com
Sun, 20 Jan 2002 16:55:36 -0000
> > Exception enception e:
except Exception, e
except => the python keyword
Exception => the type of exception, in this case
everything descended from class 'Exception'
which is all of them
e => the Exception instance representing the actual error
> Now that you know about this, it's important to say that is
> usually not such a good idea to have a catch-all unless
> the situation requires it.
Personally I nearly always do use a catch all at the top
level of my program. That's just to stop end users seeing
anything horrible like a python stack trace, during
development it's commented out. In Kirk's case the end
users won't see it so he doesn't need it.
Alan G.