Re: howto catch an Exception and still print the TraceBack?

2006-02-02 Thread Fabio Zadrozny
Saizan wrote: >Thanks, I had completely missed the module traceback... >I'll use traceback.print_exc(), it seems the most straightforward way. >The only flaw is that the traceback starts in the method where i catch the >exception and not from "__main__", but I guess it can't be helped. > > Actu

Re: howto catch an Exception and still print the TraceBack?

2006-02-01 Thread Saizan
Thanks, I had completely missed the module traceback... I'll use traceback.print_exc(), it seems the most straightforward way. The only flaw is that the traceback starts in the method where i catch the exception and not from "__main__", but I guess it can't be helped. -- http://mail.python.org/ma

Re: howto catch an Exception and still print the TraceBack?

2006-02-01 Thread Fabio Zadrozny
I find the following very good for most needs: try: raise RuntimeError('err') except: import traceback;traceback.print_exc() -- if you use Pydev, there's a template for that called printexc. Cheers, Fabio Saizan wrote: >In an event-driven application i'd like to keep the program alive

Re: howto catch an Exception and still print the TraceBack?

2006-02-01 Thread Antoon Pardon
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:

Re: howto catch an Exception and still print the TraceBack?

2006-02-01 Thread Diez B. Roggisch
Saizan wrote: > 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: See sys.exc_info() The you can do: try: .

howto catch an Exception and still print the TraceBack?

2006-02-01 Thread Saizan
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: