· til
Force Quit Python PDB
With Pythons pdb
usually q
for quit is enough to close the debugger and stop the program. When that’s not working you can follow it with a quick ctrl+c
to exit the program. But I got stuck in a loop with a poorly placed breakpoint and I didn’t want to close my terminal or use another terminal to kill it so I learned you can call os._exit()
to force the Python program to quit skipping all finally
blocks and __exit__
methods.
So for this situation import os; os._exit()
force quits pdb
and your program.
Share: