15

I'd like to break out of the currently running program and be dropped back to the shell (without having to restart ipython)

5 Answers 5

11

I had the same issue after reinstalling console2 and ipython on Windows. If you use the ipython.exe launcher, this seems to be a problem and it just closes the whole window. However, if you instead launch ipython with

python C:\python27\scripts\ipython-script.py

then it catches and handles the KeyboardInterrupt just fine and leaves me at the ipython prompt. Hooray.

Sign up to request clarification or add additional context in comments.

1 Comment

Totally works, you could add --confirm-exit to the command on top of that.
4

Control-C works in the normal interactive Python shell, it should work in ipy also (except the program is catching the keyboardInterrupt exception)

2 Comments

I'm on a Mac atm and it works. Could be a setting or a Windows thing. Does it behave the same with a clean configuration file ?
This is the case because there is a separate launcher provided titled ipython.exe in Windows. Since that just opens up a python shell, the exit criteria for it is to close the process i.e. the shell (and so in this case it closes the window)
0

Kind of a jenky method but I can often quit a process without exiting ipython by typing something like: ']='. It creates a syntax error, terminating the process and, thereby, returning you to the ipython shell.

1 Comment

This will do nothing for the code that is already running, ie. if you start a long running loop and while its being executed you type rubbish characters, the loop will be uninterrupted and the synthax error will be thrown after the loop completes.
0

This answer may be a little too late, but for anyone who comes looking for an answer, you can use ESC

1 Comment

What about Ctrl Break?
-1

For the current version of IPython(Jupyter), you can simply click on Interrupt option under kernel tab.

1 Comment

The question is not about Ipython Notebook (now Jupyter), but just IPython (interactive shell)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.