Skip to content

Instantly share code, notes, and snippets.

@arlago
Last active February 28, 2017 20:19
Show Gist options
  • Save arlago/35590512cda1eafd42f1fd0fe7aaeb91 to your computer and use it in GitHub Desktop.
Save arlago/35590512cda1eafd42f1fd0fe7aaeb91 to your computer and use it in GitHub Desktop.
Python debug with pdb

https://docs.python.org/3/library/pdb.html

Standalone pdb

Calling a pdb in the start of the script

python -m pdb <script_name>

Setting a break point

b <line_bumber>

Continue the execution of the script until it reaches the break point

c

Quit from debug and stop the script

q


Set debug break point into the script

import pdb ... pdb.set_trace() # This should be placed where you want to stop for debuging

python .py # This is the call of the script

Call the interactive debug without debug placed into the script

pdb .py

Commands

Print all the object properties

(Pdb) p dir()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment