How to force restart kernel

7,983 views
Skip to first unread message

Stack CopyrightX

unread,
Oct 11, 2014, 2:06:30 PM10/11/14
to spyd...@googlegroups.com
The Canopy python IDE has a simple command (Ctrl+.) that is reached using the menus with Run->Restart Kernel...

This forces the IDE to keep history and things like that, but to restart the python kernel (would it also be correct to say the python interpreter? or is kernel different from interpreter in this context?) so that all existing variables in memory and function definitions are flushed, allowing me to start with a clean kernel.

Is there some way to do this in Spyder?

Wang Yuxiang

unread,
Oct 11, 2014, 2:58:40 PM10/11/14
to spyd...@googlegroups.com
I have been using Spyder, and using IPython as default. I use Ctrl+. and it do the same thing.

-Shawn

Adrian Klaver

unread,
Oct 11, 2014, 3:03:46 PM10/11/14
to spyd...@googlegroups.com
On 10/11/2014 11:06 AM, Stack CopyrightX wrote:
> The Canopy python IDE has a simple command (Ctrl+.) that is reached
> using the menus with Run->Restart Kernel...

Actually this is a IPython command:

http://ipython.org/ipython-doc/stable/interactive/qtconsole.html

Process Management

With the two-process ZMQ model, the frontend does not block input during
execution. This means that actions can be taken by the frontend while
the Kernel is executing, or even after it crashes. The most basic such
command is via ‘Ctrl-.’, which restarts the kernel. This can be done in
the middle of a blocking execution. The frontend can also know, via a
heartbeat mechanism, that the kernel has died. This means that the
frontend can safely restart the kernel.

>
> This forces the IDE to keep history and things like that, but to restart
> the python kernel (would it also be correct to say the python
> *interpreter*? or is kernel different from interpreter in this context?)
> so that all existing variables in memory and function definitions are
> flushed, allowing me to start with a clean kernel.

The kernel they are referring to is the IPython kernel.

>
> Is there some way to do this in Spyder?

Yes, enter Ctrl + . in the IPython console.

>


--
Adrian Klaver
adrian...@aklaver.com

Stack CopyrightX

unread,
Oct 11, 2014, 3:08:06 PM10/11/14
to spyd...@googlegroups.com
Thank you. This worked for me. I didn't realize it was an IPython command. I did try Ctrl+. in Spyder before posting here, but I guess the focus must not have been in the IPython window because nothing happened the first time I tried it.
Reply all
Reply to author
Forward
0 new messages