How can I catch all exception in python?

2007-03-27 Thread [EMAIL PROTECTED]
I read the document here about exception handling in python: http://www.diveintopython.org/file_handling/index.html Can you please tell me how can I catch all exception in python? like this in Java: try { } catch (Throwable t) { ... } -- http://mail.python.org/mailman/listinfo/python

Re: How can I catch all exception in python?

2007-03-27 Thread kyosohma
On Mar 27, 1:09 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I read the document here about exception handling in python: http://www.diveintopython.org/file_handling/index.html Can you please tell me how can I catch all exception in python? like this in Java: try { } catch

Re: How can I catch all exception in python?

2007-03-27 Thread Gabriel Genellina
En Tue, 27 Mar 2007 15:09:18 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: I read the document here about exception handling in python: http://www.diveintopython.org/file_handling/index.html Can you please tell me how can I catch all exception in python? like this in Java: try

Re: How can I catch all exception in python?

2007-03-27 Thread irstas
On Mar 27, 9:15 pm, [EMAIL PROTECTED] wrote: Technically speaking, you can catch all errors as follows: try: # do something except Exception, e: print e That won't catch exceptions/errors that don't derive from Exception class. For example a string won't be caught: try: raise foo

Re: How can I catch all exception in python?

2007-03-27 Thread Jeff McNeil
You could also use sys.excepthook if you're trying to handle uncaught exceptions. On 27 Mar 2007 11:45:54 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Mar 27, 9:15 pm, [EMAIL PROTECTED] wrote: Technically speaking, you can catch all errors as follows: try: # do something