What do you insert into Python source code to have it break into pdb (when execution gets to that spot)?
Asked
Active
Viewed 1.1k times
2 Answers
41
import pdb; pdb.set_trace()
See Python: Coding in the Debugger for Beginners for this and more helpful hints.
Daryl Spitzer
- 133,599
- 75
- 153
- 171
-
11From [the FAQ](http://stackoverflow.com/faq): > It's also perfectly fine to ask and answer your own programming question, but pretend you're on Jeopardy: phrase it in the form of a question. – Daryl Spitzer Sep 29 '08 at 20:07
-
How would that work in an IDE? It doesn't work in Pycharm – Mawg says reinstate Monica Jul 31 '18 at 12:04
11
As of Python 3.7, you can use breakpoint() - https://docs.python.org/3/library/functions.html#breakpoint
Adam Baxter
- 1,677
- 20
- 39