In Python, is there a way to see the current stack frame? That is, I want to see a list of files which were called to get to my current location.
Essentially, I want to see
try:
1/0
except:
traceback.print_exc()
without actually raising an error.
You want a stack trace, not a stack frame (the stack frame is one area in the stack holding e.g. the local variables of the current function). The traceback module has various means to get a stack trace without raising an exception. To print a stack trace directly, use traceback.print_stack().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With