[IPython-user] KeyboardInterrupt (Ctrl-C) weirdness

Jörgen Stenarson jorgen.stenarson@bostream...
Tue Mar 17 17:31:52 CDT 2009

gooli skrev:
> I'm running Python 2.5.4 and IPython 0.9.1 with PyReadline 1.5 on Windows XP
> SP3 and I'm seeing some weird behavior with regards to hitting Ctrl-C while
> running in an infinite loop.
> I type the following code in:
> while True:
>     i = 0
> and once it starts to run I hit Ctrl-C to stop it, which does stop the loop
> but creates an anomaly. If I type a command and hit Enter, I get an error
> message from Windows cmd.exe ('sdf' is not recognized as an internal or
> external command) and get the standard C:\> command prompt. However, when I
> hit Enter again, I get the IPython green prompt back. Another Enter, back to
> command prompt, another one, back to IPython.
> Although I seem to be jumping between cmd and IPython all the commands that
> I type seem to go to cmd with their first character removed. Accidentally I
> discovered that when I type exit in the IPython prompt and then hit Enter
> twice, things seem to get back to normal.
> Since this might not easily reproduce on another system and my explanation
> above might be a bit vague, I've recorded a screen cast of what's happening.
> http://www.gooli.org/downloads/ipython-ctrl-c.avi
I have seen this behaviour when running ipython after using easy_install 
to install ipython. I believe the reason is that ipython.exe in 
python2x/scripts/ launches a second python interpreter and the ctrl-c 
interrupt is caught by the one running ipython but is somehow propagted 
to the second one which is terminated. I do not know how to fix this 

copied from an old message on ipython-dev:

I usually add .py and .pyw to PATHEXT and %PYTHON_INSTALL_DIR%/scripts
to PATH to ensure I can just type ipython at the commandprompt. With
these environment variables set, I can run ipython just fine at the
cmd-prompt after running a windows installer from latest trunk.

It looks like the ipython shell script in %PYTHON%/Scripts is copied to
ipython.py on line 76 in ipython_win_post_install.py perhaps the other
scripts should be given the same treatment.


More information about the IPython-user mailing list