472,135 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,135 software developers and data experts.

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 2206
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.