How to Debug Python Restarts
The Python programming language can be used to launch applications and other scripts to generate reports and perform computing tasks. If you find that your Python scripts are causing applications to restart, or if the script itself is restarting before it finishes, there are a couple of key things you can check to help debug the problem and stop the unwanted restarts.
Instructions
-
-
1
Launch a command line terminal interface on your computer and access the folder that contains the Python script you want to debug by typing "cd" followed by the directory path where the script is located.
-
2
Type the following commands (replacing "examplemodule" with the name of the Python module that you wish to debug):
import pdb
import examplemodule -
-
3
Type the following command to run the debugging tool and locate the source of the error:
pdb.run('examplemodule.test()')
-
4
Examine the output that's displayed in the command line window after running the command in the previous step to see what parts of your Python code are causing the restarts.
-
5
Open your Python script in a text editing application and search its code for the commands "restart" and "run." Ensure that they are not erroneously placed in your code.
-
1