The remote debugging Python program primarily uses logging and PDB for debugging. On the one hand there is no permission to install IPDB, on the other hand it cannot be debugged locally.
How to use
The PDB is a module that comes with Python, so no additional installation is required. If you need more advanced debugging, you can try IPDB. Insert a breakpoint where you want to debug:
import pdb;pdb.set_trace()
Note that breakpoints are blocking, so be sure to remove breakpoints before you go live. So from this point of view the print log is more convenient than setting breakpoints.
If the number of lines of code is small, and the way to start the program is simple, you can also use the following command debugging, eliminating the addition of breakpoints and delete breakpoints.
python -m pdb ouyangsong.py
Common commands
P
Calculates and prints the values of variables, and print
similar. You can also enter the variable name directly and the value of the variable will be printed.
N
The next line can be used when debugging by line.
C
Continue running until the next breakpoint, which is the abbreviation for continue.
L
Look at the code near the breakpoint to make it easy to know where you are.
B
Add a line number in the back, and you'll be adding breakpoints dynamically.
S
Go inside the function.
R
Executes the code until it is returned from the current function.
Q
Force exit so the program exits unexpectedly.
Commands
is actually executing any code. such as forcing a change to test different examples.
https://www.ouyangsong.com/posts/55555/
PDB Common Commands