The PythonDebuggingTools documentation says that the Python debugger pdb
is "part of all Python installations", yet I can't find it under macOS High Sierra:
pdb: command not found
Is it supposed to be installed as normal part of macOS these days?
Starting Python Debugger To start debugging within the program just insert import pdb, pdb. set_trace() commands. Run your script normally, and execution will stop where we have introduced a breakpoint. So basically we are hard coding a breakpoint on a line below where we call set_trace().
The module pdb defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and evaluation of arbitrary Python code in the context of any stack frame.
Importing the pdb module and running the pdb. set_trace() function lets you begin your program as usual and run the debugger through its execution.
There is not a command named pdb
, but you could invoke pdb from shell with:
python -m pdb your_script.py
you could read more methods to invoke pdb
in its doc.
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