Search code examples
pythonpdb

how to disable pdb.set_trace() without stopping python program and edit the code


I suspect that I have issue in one of my loops, so I setup a break points with pdb.set_trace()

import pdb
for i in range(100):
    print("a")
    pdb.set_trace()
    print("b")

after check variable in this loop for a few times, I decide continue this programming without further breaks. So I try to get the break number with b command, no breaks listed. I guess this line of code don't setup a break point. but How Do I get ride of this "break points" without stopping the program and change the code?


Solution

  • to my knowledge, you could not bypass set_trace, but you could neutralize it, once debugger stopped, type:

    pdb.set_trace = lambda: 1
    

    then continue, it wont break again.