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.<div>
Antony</div><div class="gmail_extra"><br><br><div class="gmail_quote">2012/12/4 Antony Lee <span dir="ltr"><<a href="mailto:antony.lee@berkeley.edu" target="_blank">antony.lee@berkeley.edu</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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.<div><br></div><div>So, I followed the recipe here: <a href="http://stackoverflow.com/questions/11513132/embedding-ipython-qt-console-in-a-pyqt-application" target="_blank">http://stackoverflow.com/questions/11513132/embedding-ipython-qt-console-in-a-pyqt-application</a></div>
<div>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!".</div>
<div><br></div><div>Thanks in advance for your help,</div><div><br></div><div>Antony</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">2012/12/4 Thomas Kluyver <span dir="ltr"><<a href="mailto:takowl@gmail.com" target="_blank">takowl@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
<br>Thomas<br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>
On 4 December 2012 09:31, Antony Lee <span dir="ltr"><<a href="mailto:antony.lee@berkeley.edu" target="_blank">antony.lee@berkeley.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
Hi all,<br>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...).<br>
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.<br>
Any help would be welcome!<span><font color="#888888"><br>Antony<br>
</font></span><br></div></div>_______________________________________________<br>
IPython-User mailing list<br>
<a href="mailto:IPython-User@scipy.org" target="_blank">IPython-User@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
IPython-User mailing list<br>
<a href="mailto:IPython-User@scipy.org" target="_blank">IPython-User@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>