Showing the stack trace from a running Python application

I have this Python application that gets stuck from time to time and I can’t find out where. Is there any way to signal Python interpreter to show you the exact code that’s running? Some kind of on-the-fly stacktrace? Related questions: Print current call stack from a method in Python code Check what a running … Read more

Determine function name from within that function (without using traceback)

In Python, without using the traceback module, is there a way to determine a function’s name from within that function? Say I have a module foo with a function bar. When executing foo.bar(), is there a way for bar to know bar‘s name? Or better yet, foo.bar‘s name? #foo.py def bar(): print “my name is”, … Read more

How to catch and print the full exception traceback without halting/exiting the program?

I want to catch and log exceptions without exiting, e.g., try: do_stuff() except Exception as err: print(Exception, err) # I want to print the entire traceback here, # not just the exception name and details I want to print the exact same output that is printed when the exception is raised without the try/except intercepting … Read more