Catch occasional exceptions - curses
Josh Close
narshe at gmail.com
Thu Jul 29 17:36:19 EDT 2004
I've found there is another easy way of doing this. Use sys.excepthook
def errorHandler():
# do error handingl
# this will catch all leftover excptions
sys.excepthook = errorHandler
this way you don't have to wrap the whole program in a tr/except
-Josh
On Thu, 29 Jul 2004 23:22:58 +0200, Thomas Lindgaard
<thomas at it-snedkeren.black_hole.dk> wrote:
> On Wed, 28 Jul 2004 18:37:31 -0400, Peter Hansen wrote:
>
> > try:
> > #
> > except:
> > traceback.print_exc(sys.exc_info())
> >
> > Variations on that using other functions in the traceback
> > module are easy...
>
> OK - I've wrapped most of my main function and run the crawler... but it
> hasn't thrown an exception yet, so I don't know if it does the job. But
> thanks :)
>
> --
> Regards
> /Thomas
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list