show_locals on traceback #1542
-
Hi, But I noticed some locals refer to the last traceback. Consider the following example:
The output I get (note
It seems like the "Traceback from_exception" is capturing the locals at the time you call it. Is there a way to capture the locals at the time the exception is intercepted by the context manager and supplying those locals to "from_exception"? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Rather than save a dict with |
Beta Was this translation helpful? Give feedback.
Rather than save a dict with
ext_type
etc, construct a Traceback() instance which will snapshot the local variables. You can then print those Traceback objects whenever you like.