When we can’t understand the execution path or behaviour of our program we better use a debugger.
Python offers pdb, a full featured debugger. Here is how to get started.
Import it with:
import pdb Set a breakpoint with:
pdb.set_trace()
# The script execution will then stop
# and let you debug.You can also trace full program with:
python -m trace --trace my_program.py