what exception is it?

Josiah Carlson jcarlson at uci.edu
Thu Oct 14 04:40:20 CEST 2004


> try:
> 	[do something]
> except IOError: [IO error handling]
> except TypeError: [Type error handling]
> except: [other error handling]
> 
> in [other error handling], one of the things I need to do is to display 
> to the use the kind of exception raised and the message, if any.
> 
> How can I do this without a big if statement to go through the list of 
> exceptions?

import traceback

try:
    #stuff
#other except statements
except:
    traceback.print_exc()



 - Josiah




More information about the Python-list mailing list