catching all exceptions

Paolino paolo_veronelli at tiscali.it
Sat Aug 13 13:32:27 EDT 2005


a_geek at web.de wrote:
> Hello,
> 
> I'd like to catch all exeptions and be able to inspect them.
> 
> The simple case: I know which exceptions I'll get:
> 
> # standard textbook example:
> try:
>     something()
> except ThisException, e:
>     print "some error occurred: ", str(e)
> 
> 
> The not-so-simple case: Handling all other exceptions:
> 
> # nice-to-have:
> try:
>     something()
> except *, e:
>     print "some error occurred: ", type(e), str(e)
> 
> 
except Exception:# catch them all.

Then use moudule 'traceback' to inspect

Paolino

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



More information about the Python-list mailing list