How to check which line of a Python script is being executed?
问题 I've got a Python script which is running on a Linux server for hours, crunching some numbers for me. I'd like to check its progress, so I'd like to see what line is being executed right now. If that was a C or C++ program then I would just attach to the process with gdb -p <pid> and examine the stacktrace with where . Of course, I can do the same with the Python interpreter process, but I can't see the Python script's line in the stacktrace. So, how can I find out which line of the Python