ipdb: quit does not abort
I hope I’m not the only one with this problem, but since I’ve upgraded to IPython 5, it is impossible to quit from a ipdb session, as before.
Here is a sample script:
def main():
print('hello')
while True:
import ipdb; ipdb.set_trace()
print('loop')
if __name__ == '__main__':
main()
And a sample run:
python3 mwe.py
hello
> /home/dojeda/temp/mwe.py(5)main()
3 while True:
4 import ipdb; ipdb.set_trace()
----> 5 print('loop')
6
7 if __name__ == '__main__':
ipdb> c
loop
> /home/dojeda/temp/mwe.py(4)main()
2 print('hello')
3 while True:
----> 4 import ipdb; ipdb.set_trace()
5 print('loop')
6
ipdb> q
loop
> /home/dojeda/temp/mwe.py(5)main()
3 while True:
4 import ipdb; ipdb.set_trace()
----> 5 print('loop')
6
7 if __name__ == '__main__':
ipdb> quit()
loop
> /home/dojeda/temp/mwe.py(4)main()
2 print('hello')
3 while True:
----> 4 import ipdb; ipdb.set_trace()
5 print('loop')
6
ipdb> !!q
loop
> /home/dojeda/temp/mwe.py(5)main()
3 while True:
4 import ipdb; ipdb.set_trace()
----> 5 print('loop')
6
7 if __name__ == '__main__':
ipdb> import sys; sys.exit(0)
*** SystemExit: 0
ipdb>
Version information: ipdb==0.10.1 ipython==5.1.0
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 35
- Comments: 19 (1 by maintainers)
Use
import os; os._exit()
as a workaroundAdd to
~/.pdbrc
:then hit
kk
from inside anipdb
session, to exit.(this is just a convenient workaround, the issue still needs to be fixed!)
How can we elevate the priority of this issue, or at least get it assigned to someone? It’s a complete show-stopper and is hurting ipdb uptake.
I believe you can close this issue as https://github.com/ipython/ipython/pull/10009 fixed the bug. I just upgraded from 5.1 to 5.3 and it is all good.
After some more investigation, it turns out that this is actually an IPython issue. A fix is in the make for IPython 5.2. https://github.com/ipython/ipython/issues/10006
Downgrade to
ipython==5.0.0
Hello, I have the exact ssame issue.When I run python2 code, i cannot exit the debugger.
This outputs me when i try to exit:
Hi, Is there any news about this issue?
@ssbarnea I am happy that you nicely offer to make it happen. PR welcome.