How to exit pdb and allow program to continue?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Techno Intrigue Looping
--
Chapters
00:00 How To Exit Pdb And Allow Program To Continue?
00:29 Accepted Answer Score 290
00:59 Answer 2 Score 5
01:43 Answer 3 Score 54
01:55 Answer 4 Score 16
02:39 Thank you
--
Full question
https://stackoverflow.com/questions/1782...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pdb
#avk47
ACCEPTED ANSWER
Score 290
continue should "Continue execution, only stop when a breakpoint is encountered", so you've got a breakpoint set somewhere. To remove the breakpoint (if you inserted it manually):
(Pdb) break
Num Type Disp Enb Where
1 breakpoint keep yes at /path/to/test.py:5
(Pdb) clear 1
Deleted breakpoint 1
(Pdb) continue
Or, if you're using pdb.set_trace(), you can try this (although if you're using pdb in more fancy ways, this may break things...)
(Pdb) pdb.set_trace = lambda: None # This replaces the set_trace() function!
(Pdb) continue
# No more breaks!
ANSWER 2
Score 54
A simple Ctrl-D will break out of pdb. If you want to continue rather than breaking, just press c rather than the whole continue command
ANSWER 3
Score 16
The answer from @voithos is correct, so I'll just add one alternative in the case where you are using set_trace. Yes, the pdb.set_trace = lambda: None hack works OK, but not if you have other breakpoints set and want to reenable it later on. To me this points to the fact that unfortunately pdb is missing a bunch of functionality (even basic stuff like display lists), and this is another case.
The good news is that pdb++ is a great drop-in replacement for pdb, and one of the things it solves is exactly the problem of disabling set_trace. So you can simply do:
pip install pdbpp
and then at the (Pdb++) prompt, type:
pdb.disable()
If you want to reenable later, unsurprisingly this works:
pdb.enable()
Easy! And you will get lots of other useful goodies on top of that.
ANSWER 4
Score 5
If you really wish to exit the debugger then you need to run something like WinPdb which allows you to detach from the process and then exit the debugger, (N.B. It is multi-platform).
If you would like to continue debugging but no longer stop at a given breakpoint then you need to:
- Make a note of the breakpoint number, (or the file and line number),
- Either
cl bp_numberorclear file:lineto permanently remove the breakpoint ordisable pb_numberto toggle it off but be able to toggle it back. - Then
continueand your program run until then next different breakpoint is hit.
For more detail on the above see the manual.