Getting a stack frame
How do I get the stack stack to go to traceback.print_stack
?
From Python 3.3a1 :
traceback.print_stack(f=None, limit=None, file=None)
This function prints the stack trace from the point of the call. An optional
f
argument can be used to specify an alternate stack frame to start. the optional arguments limit and file have the same meaning as forprint_exception()
.
But nowhere in the docs I found a way to get the stack frame. To be specific, let's say I want to print a stack trace starting at the level above the calling point. How can i do this?
source to share
This documentation contains information about functions that you can use to get a stack frame, eg inspect.currentframe()
.
source to share