Re: get_traceback

2007-06-05 Thread Gabriel Genellina
En Mon, 04 Jun 2007 23:03:04 -0300, <[EMAIL PROTECTED]> escribió: > Thanks Gabriel. That was exactly what I was looking for. Also, I'm > glad to make a connection to the StringIO class. I'm sure I will > remember it the next time I need it. Glad to see it helped. Certainly StringIO is a good t

Re: get_traceback

2007-06-04 Thread half . italian
On Jun 4, 3:51 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 04 Jun 2007 14:23:00 -0300, <[EMAIL PROTECTED]> escribió: > > > Is there a function or idoim for returning an exception/traceback > > rather than just printing it to stdout? I'm running a deamon where > > stdout is going t

Re: get_traceback

2007-06-04 Thread Gabriel Genellina
En Mon, 04 Jun 2007 14:23:00 -0300, <[EMAIL PROTECTED]> escribió: > Is there a function or idoim for returning an exception/traceback > rather than just printing it to stdout? I'm running a deamon where > stdout is going to /dev/null, and I'm not even watching it..until > now. All the functions

Re: get_traceback

2007-06-04 Thread kyosohma
All the functions I found in traceback and sys seemed only to > print the error rather than just returning it, so I resorted to this: > > def get_traceback(): > import traceback, tempfile > stdout = sys.stdout > > f = tempfile.TemporaryFile(mode='w+

get_traceback

2007-06-04 Thread half . italian
ror rather than just returning it, so I resorted to this: def get_traceback(): import traceback, tempfile stdout = sys.stdout f = tempfile.TemporaryFile(mode='w+') sys.stdout = f traceback.print_tb(sys.exc_info()[2]) error = f.re