Skip to content

Instantly share code, notes, and snippets.

Avatar

Stefaan Lippens soxofaan

View GitHub Profile
@soxofaan
soxofaan / pyrasite-stacktrace-how-to.md
Last active Oct 6, 2020 — forked from reywood/how-to.md
How to get a stack trace from a stuck/hanging python script
View pyrasite-stacktrace-how-to.md

How to get a stack trace for each thread in a running Python script

Sometimes a Python script will simply hang forever with no indication of what is going wrong. Perhaps it's polling a service that will never return a value that allows the program to move forward.

Here's a way to see where the program is currently stuck, using pyrasite a tool for injecting code into running Python processes.

Install gdb and pyrasite

Install gdb.

You can’t perform that action at this time.