[PyQt] Handling the uncaught exceptions
sundance at ierne.eu.org
Fri Jan 25 09:19:41 GMT 2008
> Is there a way to handle the uncaught exceptions that happen in PyQt?
Yup: install your own exception handler in sys.excepthook.
You'll find a somewhat fancy exception handler I wrote a while back as
the handle_exception() function (starting line 146) in this file:
The gist of it is, any function that takes the parameters exc_type,
exc_value and exc_traceback, and DOESN'T use exceptions internally,
will serve. Do note that your PyQt application will /not/ exit after
calling the exception handler, so if you want that, call sys.exit()
right in your exception handler.
More information about the PyQt