Willy Wonka
Willy Wonka

Reputation: 81

How do you programmatically pause the debugger from the debugged script and inspect the stack of every active thread?

I have a really determined glitch that occurs in conjunction with me seeing The filename, directory name, or volume label syntax is incorrect. printed to the console - which happens when the script has been running for a couple of hours. So I need a way of "pausing" the script so I can inspect it and see whats causing the glitch.

I'm currently running the following setup:

originalPrint=print # @todo Remove when finished debugging
def print_(*args,**kwargs):
    originalPrint(f"printing:{args}{kwargs}")
    originalPrint(*args,**kwargs)
__builtins__["print"]=print_

In hopes that whatever is printing the message I see in console uses pythons built in print statement. If that turns out to be the case, how would I modify this function to "pause" the script in a way that lets me inspect the stack frames of all running threads within the program?

Also, if I can be picky it would be nice if I could use Visual Studio Code's debug view to inspect the stack frames, but I'm genuinely desperate so any pointers or tips would be greatly appreciated.

Upvotes: 0

Views: 41

Answers (0)

Related Questions