Op 2006-02-01, Saizan schreef <[EMAIL PROTECTED]>:
> In an event-driven application i'd like to keep the program alive regardless 
> of any exceptions raised by the handlers,
> but still be able to debug them by reading the appropriate TraceBack from 
> stderr.
> I can put something like:
>
> try:
>       self.call_handler(handler,*args)
> except Exception, e:
>       print e
>       print e.args
>
> in the dispatcher, but that isn't as helpful as a complete TraceBack.

You mean something like this?

    import traceback
    import sys

    try:
        self.call_handler(handler,*args)
    except Exception, e:
        Do_whatever_you need_to_do()
        for msg in traceback.format_tb(sys.exc_info()[2]):
            sys.stderr.write("%s\n" % msg)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to