Capturing exceptions?

Dfenestr8 chrisdewinN0SPAM at
Wed Aug 25 20:18:09 CEST 2004

On Wed, 25 Aug 2004 19:19:06 +0200, Mathias Waack wrote:

> Dfenestr8 wrote:
>> What's the easiest way to capture the traceback from an exception, and
>> write it to a file? Ideally, I'd like to be able to do something like:
>>>write the traceback to a file
> Have a look at the traceback module.
> Mathias

I did. Thanx. But I'm afraid I don't understand it.

>From looking at the docs, it would appear the method extract.tb(traceback,
limit) is the method I want. But it appears to want some kind of object as
its parameter, and I have no idea what kind of object that is.
I've tried "a = traceback.extract_tb(tb)",
"traceback.extract_tb(traceback)", "traceback.extract_tb(sys.exc_info())".

What kind of parameter does it need? 

More information about the Python-list mailing list