I have long-running python programs that do not have sufficient internal logging. I'd like to be able to attach to a running python program and find out it's current line number. Ideally, I'd like to do this without interrupting its execution, but I'm happy to have it pause, print the stack t race, and then keep going.
I could easily type control-C, but that would kill the program.
Is there any way to do this?
pdbworks great if you launch the program under pdb, but it doesn't look like it can attach to a running python program or perform introspection.