What do you insert into Python source code to have it break into pdb (when execution gets to that spot)?
            Asked
            
        
        
            Active
            
        
            Viewed 1.2k times
        
    2 Answers
42
            import pdb; pdb.set_trace()
See Python: Coding in the Debugger for Beginners for this and more helpful hints.
 
    
    
        Daryl Spitzer
        
- 143,156
- 76
- 154
- 173
- 
                    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
14
            
            
        As of Python 3.7, you can use breakpoint() - https://docs.python.org/3/library/functions.html#breakpoint
 
    
    
        Adam Baxter
        
- 1,907
- 21
- 41
