Re: Retrieving a stacktrace from an exception object / forwarding an exception

2007-06-22 Thread Samuel
Thanks, Guys, this works as expected. -Samuel -- http://mail.python.org/mailman/listinfo/python-list

Re: Retrieving a stacktrace from an exception object / forwarding an exception

2007-06-22 Thread alg
Use the traceback module: def log_exception(): """This function will log the current exception's traceback to logfile """ import traceback f = open("logfile", 'a') traceback.print_exc(32, f) f.close() def my_func(): raise Exception def wrapper(): try:

Re: Retrieving a stacktrace from an exception object / forwarding an exception

2007-06-22 Thread Gabriel Genellina
En Fri, 22 Jun 2007 03:54:12 -0300, Samuel <[EMAIL PROTECTED]> escribió: > I am trying to wrap a function that throws an exeption in such a way > that the stacktrace is logged into a file and the exception is > forwarded after that. For example: > > --- > def my_func(): > raise