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
> 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"
except Exception, e:
   print e

But this will catch all exceptions:

try:
   raise "foo"
except:
   print sys.exc_info()

(there may be other ways I don't know of)

--
http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to