Can I stop execution of current module in ipython

2019-02-16 09:50发布

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

标签: ipython
4条回答
贪生不怕死
2楼-- · 2019-02-16 10:09

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

查看更多
淡お忘
3楼-- · 2019-02-16 10:22

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.

查看更多
淡お忘
4楼-- · 2019-02-16 10:30

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.

查看更多
相关推荐>>
5楼-- · 2019-02-16 10:33

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

查看更多
登录 后发表回答