2

How do you exit the ipdb debugger? According to this question typing q should just work. I am on Python 3.6.6, Ipython 6.4.0 and that does not work in the following context: I have a function, f(x), that is called from another function in a loop. After 2 iterations I just want to stop evaluation and exit the debugger. My f(x) just looks like this:

def f(x):
    ipdb.set_trace()

Literally meant to allow me to inspect x at runtime. However, typing q does not exit the debugger. Typing os._exit(0) kills the kernel. There must be something better? This is within a jupyter notebook.

Alex
  • 1,281
  • 1
  • 13
  • 26
  • Ctrl-D should work fine here. At least that's what I do. – idjaw Jul 26 '18 at 01:40
  • that's mapped to a browser shortcut, what is ctr-d? – Alex Jul 26 '18 at 01:42
  • Oh, apologies this is in jupyter. Have you read [this](https://github.com/gotcha/ipdb/issues/111)? It's a closed issue, so it might provide details on a solution. Sorry, not much help. I'm not a jupyter user. – idjaw Jul 26 '18 at 01:46
  • indeed that appears to be the issue, but i'm on a much later version and it looks like still having this problem... i think i may stop being a jupyter user very soon as well – Alex Jul 26 '18 at 01:47
  • Silly suggestion, but have you tried another browser just to see if there might be browser-specific shenanigans happening? – idjaw Jul 26 '18 at 01:49
  • haven't, on chrome, worth a try but i think pretty unlikely – Alex Jul 26 '18 at 01:49
  • on a random note: what do you use to develop if not the jupyter group of products? – Alex Jul 26 '18 at 01:50
  • I use [PyCharm](https://www.jetbrains.com/pycharm/). – idjaw Jul 26 '18 at 01:51

1 Answers1

2

as i remember this used to be a bug in IPython 5.1, you can try Ctrl+d to exit the debugger, or quit(), or you can use Ctrl+z.

Last thing you can try is Ctrl+c.

Madtasmo
  • 21
  • 5
  • Well last thing you can use is Click on the menu "Kernel" select "restart" and click on the button "restart". – Madtasmo Jul 26 '18 at 01:58
  • that's the same effect as `os._exit(0)`, i don't want to kill the kernel and have to rerun the whole notebook to get back to my last dev point – Alex Jul 26 '18 at 02:00