Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python debugger pdb not found on macOS High Sierra

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?

like image 493
Drux Avatar asked Dec 09 '17 12:12

Drux


People also ask

How do I use pdb debugger in Python?

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().

What is Python pdb module?

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.

What does import pdb pdb Set_trace () do?

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.


1 Answers

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.

like image 87
georgexsh Avatar answered Sep 30 '22 10:09

georgexsh