Getting started with the Python debugger, pdb [closed]
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this questionI want to add pdb—the Python debugger—to my toolbox. What's the best way to get started?
Here's a list of resources to get started with the Python debugger:
- Read Steve Ferb's article "Debugging in Python"
- Watch Eric Holscher's screencast "Using pdb, the Python Debugger"
- Read the Python documentation for pdb — The Python Debugger
- Read Chapter 9—When You Don't Even Know What to Log: Using Debuggers—of Karen Tracey's Django 1.1 Testing and Debugging.
Synopsis:
# epdb1.py -- experiment with the Python debugger, pdb
import pdb
a = "aaa"
pdb.set_trace()
b = "bbb"
c = "ccc"
final = a + b + c
print final
Now run your script:
$ python epdb1.py
(Pdb) p a
'aaa'
(Pdb)
精彩评论