I have a python script that occasionally freezes and I'd like to find out why? Is there a way to hook into a python script and see what the variables are what line its on and/or what its doing?
Imagine a python script that will take a long time to run, what will happen if I modify it while it's running? Will the result be different? The program is loaded into your main memory. If you change the source file, nothing happens.
Running Python Scripts using an IDE or a Text Editor You can use other IDEs like Spyder, PyCharm, Eclipse, and Jupyter Notebook which also allow you to run your scripts inside its environment. You can also use popular text editors like Sublime and Atom to run Python script.
Use a debugger as shown in the answers to How do I attach a remote debugger to a Python process?
Once attached, you can pause execution and examine variables, the current stack, etc...
As pointed out in the comments, the linked debuggers apparently require the process to be launched in a particular manner. Visual Studio (With Python Tools installed) does support attaching to a running process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With