[IPython-User] Interrupting current calculation in an ipython embedded in a Qt gui app

Antony Lee antony.lee@berkeley....
Tue Dec 4 16:53:07 CST 2012

Actually, I got a reasonable solution: ctrl-c in the console window (not
the qtconsole) that pops up in Windows when starting a GUI (with
python.exe, not pythonw.exe) does what I want.  Not optimal but good enough
for me.

2012/12/4 Antony Lee <antony.lee@berkeley.edu>

> Actually the trouble with zmq was probably due to some sloppy installation
> of python and distribute themselves on windows (not my usual platform); I
> fixed that now.
> So, I followed the recipe here:
> http://stackoverflow.com/questions/11513132/embedding-ipython-qt-console-in-a-pyqt-application
> to embed a qtconsole in my app; however I am still unable to interrupt a
> calculation running in ipython.  Now Ctrl-C gives me either no response, or
> sometimes the error message "Kernel process is either remote or
> unspecified. Cannot interrupt.", but only after execution has finished, and
> because this recipe does not put IPython in its own thread (I did try
> initializing the kernel with --gui=qt, to no avail), the GUI hangs; and if
> I send an interrupt_kernel() to the kernel_manager after while no
> computation is running, I get a "RuntiemError: Cannot interrupt kernel. No
> kernel is running!".
> Thanks in advance for your help,
> Antony
> 2012/12/4 Thomas Kluyver <takowl@gmail.com>
>> What trouble do you have with zmq? That's the way we support the Qt
>> console, including on Windows, so it sounds like the best point to tackle.
>> Thomas
>> On 4 December 2012 09:31, Antony Lee <antony.lee@berkeley.edu> wrote:
>>>  Hi all,
>>> I am embedding ipython in a Qt gui app.  ipython is running in its own
>>> QThread (in the terminal, not in a Qt widget -- I have trouble making zmq
>>> work on Windows and I have to support this platform too...).
>>> I would like a way to stop the computation ipython is currently doing,
>>> either with Ctrl-C, or with a command from the app (basically something
>>> like throwing a KeyboardInterrupt in ipython's thread).  Unfortunately,
>>> Ctrl-C raises a KeyboardInterrupt in the *main* thread, not ipython's
>>> thread; and I see no way to achieve that by running commands from another
>>> thread.
>>> Any help would be welcome!
>>> Antony
>>> _______________________________________________
>>> IPython-User mailing list
>>> IPython-User@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20121204/367fcac4/attachment-0001.html 

More information about the IPython-User mailing list