James Kingston Clarke

TIL About Python stacktraces

traceback.print_stack() can be used to print the current stacktrace from anywhere within a running python program

# print the stacktrace on ctrl+c on unix
signal.signal(signal.SIGUSR1, lambda: traceback.print_stack())

References