[IPython-User] Embedded ipython in QT: display runfile exceptions

Thomas Kluyver takowl@gmail....
Tue Sep 17 11:16:09 CDT 2013

On 10 September 2013 12:13, gabriele.lanaro <gabriele.lanaro@gmail.com>wrote:

> Hi! I'm building a pyqt application where the main user interface element
> is
> an ipython shell. I took a code from a recipe online
> http://pastebin.com/0CgT3Zdt

Have you also see the in process kernel? Online recipes might predate the
addition of that, which I think makes it easier to do what you're trying to


>  Now I'm trying to setup the environment by executing arbitrary code at the
> startup. The strategy I've been using was to execute the code in the shell
> by using
> http://ipython.org/ipython-doc/rel-1.0.0/api/generated/IPython.core.interactiveshell.html#IPython.core.interactiveshell.InteractiveShell.run_code
> The problem I'm having is that errors and exceptions run in this way pass
> silently.

I'm not sure, but I think the issue is that you're running code directly in
the underlying shell object, so the errors aren't being passed to the
frontend. The kernel expects to get an execution request from the frontend,
and then it will pass back any output, including exceptions. You would use
a kernel client to make requests. Again, have a look at the example I
posted above, which includes creating a kernel client.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130917/f2a8cfab/attachment.html 

More information about the IPython-User mailing list