Wednesday, November 5, 2014

How to interrupt Ipython Kernel in Spyder IDE (Anaconda)


In Spyder IDE, the usual interrupt 'Ctrl-C' does not work if you are running your script on an IPython Console. This is because multiple of these consoles are linked to a single kernel. In fact, this message is displayed on the kernel itself :

NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

Read more about this, here.


A quick work-around this is to tweak some settings in Spyder:

Go to Run -> Configure. Select Execute in a new dedicated Python console. Check Interact with the Python console after execution.

Now when you run a script, the Interrupt button on the right top of the console should stop the script.