Simpler way to put PDB breakpoints in Python code?

You can run your program into pdb from the command line by running

python -m pdb your_script.py

It will break on the 1st line, then you’ll be able to add a breakpoint wherever you want in your code using the break command, its syntax is:

b(reak) [[filename:]lineno | function[, condition]]

It is flexible enough to give you the ability to add a breakpoint anywhere.

Leave a Comment