Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views1 page

Python PDB

This document is a cheat sheet for the Python debugger (pdb), detailing how to invoke the debugger and set breakpoints. It includes basic commands for inspecting variables, navigating the call stack, and managing breakpoints. The cheat sheet serves as a quick reference for developers using pdb for debugging Python code.

Uploaded by

nitsce
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Python PDB

This document is a cheat sheet for the Python debugger (pdb), detailing how to invoke the debugger and set breakpoints. It includes basic commands for inspecting variables, navigating the call stack, and managing breakpoints. The cheat sheet serves as a quick reference for developers using pdb for debugging Python code.

Uploaded by

nitsce
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python pdb Cheat Sheet

by ralienpp via cheatography.com/18926/cs/2027/

Invoking the debugger Breakp​oints

import pdb; pdb.se​t_t​race() Within the code b 45 set on line 45

python -m pdb file.py From the command line b 45, x == 'abc' set with condition

b list current breakp​oints


Basic commands
b funcName set breakpoint in function
p print variable value b file.py:41 set on line 41 of file.py
pp pretty print cl clear all breakp​oints
a print input args of function cl 42 clear breakpoint #42
locals show local variables tbreak ... hit only once, syntax as b
n next
disable 42 turn off breakpoint #42
s step inside a function
enable 42 enable breakpoint #42
c continue
ignore 42 [N] ignore bp#42 N times
r run until func returns
condition 42 x=='abc' set condition to bp (no condition = remove it)
<En​ter> repeat previous command

l print nearby code

l from,to print code between lines

w where am I + traceback

u up the call stack

d down the call stack

q quit

h help

h command info about a command

By ralienpp Published 18th June, 2014. Sponsored by Readability-Score.com


cheatography.com/ralienpp/ Last updated 18th June, 2014. Measure your website readability!
Page 1 of 1. https://readability-score.com

You might also like