469,609 Members | 1,666 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

sys.excepthook, getting traceback values

When sys.excepthook is called, type, value and traceback are passed
into it. How do I get the values of traceback?

I've tried printing it, but I get the memory location. I'm gussing
there are some methods to use on it.
From what I can tell the traceback that's passed in works differently

from the module traceback.

I just need to get the traceback to log it. I can use type and value,
but that doesn't print what line the error occurred.

-Josh
Jul 18 '05 #1
1 2147
Here is what I use:

import traceback
#
# Get traceback lines
#
tblines=traceback.format_exception(type, value, tb)

Basically this is what prints in an uncaught exception.
You can then print, write to file, etc.

HTH,
Larry Bates
Syscon, Inc.

"Josh Close" <na****@gmail.com> wrote in message
news:ma*************************************@pytho n.org...
When sys.excepthook is called, type, value and traceback are passed
into it. How do I get the values of traceback?

I've tried printing it, but I get the memory location. I'm gussing
there are some methods to use on it.
From what I can tell the traceback that's passed in works differently

from the module traceback.

I just need to get the traceback to log it. I can use type and value,
but that doesn't print what line the error occurred.

-Josh

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Lunchtimemama | last post: by
1 post views Thread by Jesus Rivero - (Neurogeek) | last post: by
1 post views Thread by Hari Sekhon | last post: by
reply views Thread by Larry Bates | last post: by
1 post views Thread by Hari Sekhon | last post: by
1 post views Thread by ian | last post: by
3 posts views Thread by Sami Vaisanen | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.