IPython - Enhanced Interactive Python

Exception hook should be optional for embedding IPython in GUIs

Reported by Gael Varoquaux on 2009-03-03
2
Affects Status Importance Assigned to Milestone
IPython
Triaged
High
Unassigned

Bug Description

When embbeding IPython, the exception hook (IPython crashed.... ) captures exception that are not IPython exceptions. It can be desirable not to capture any exceptions and to let the application designer deal with the exceptions.

As such, it would be nice if the main exception hook could be disabled by a switch on the IPython0 instance.

On Tue, Mar 3, 2009 at 10:19 AM, Gael Varoquaux
<email address hidden> wrote:
> Public bug reported:
>
> When embbeding IPython, the exception hook (IPython crashed.... )
> captures exception that are not IPython exceptions. It can be desirable
> not to capture any exceptions and to let the application designer deal
> with the exceptions.
>
> As such, it would be nice if the main exception hook could be disabled
> by a switch on the IPython0 instance.

I accomplish this in qt ui by:

# cruel hack to avoid subclassing and prevent crash handler
IPython.iplib.InteractiveShell.isThreaded = True

--
Ville M. Vainio
http://tinyurl.com/vainio

On Tue, Mar 03, 2009 at 08:28:03AM -0000, Ville M. Vainio wrote:
> On Tue, Mar 3, 2009 at 10:19 AM, Gael Varoquaux
> <email address hidden> wrote:
> > Public bug reported:

> > When embbeding IPython, the exception hook (IPython crashed.... )
> > captures exception that are not IPython exceptions. It can be desirable
> > not to capture any exceptions and to let the application designer deal
> > with the exceptions.

> > As such, it would be nice if the main exception hook could be disabled
> > by a switch on the IPython0 instance.

> I accomplish this in qt ui by:

> # cruel hack to avoid subclassing and prevent crash handler
> IPython.iplib.InteractiveShell.isThreaded = True

OK, that will do the trick. I believe we can close this bug report.

Thanks,

Gaël

Fernando Perez (fdo.perez) wrote :

Closing as won't fix since the solution is more of a workaround. As we refactor things, we can offer later a nicer way to do this. But I'm happy to close for now.

Changed in ipython:
status: New → Won't Fix

On Sat, Mar 14, 2009 at 12:52:18PM -0000, Fernando Perez wrote:
> Closing as won't fix since the solution is more of a workaround. As we
> refactor things, we can offer later a nicer way to do this. But I'm
> happy to close for now.

> ** Changed in: ipython
> Status: New => Won't Fix

I have just implemented this in the Enthought codebase (will move it up
to the frontend code in IPython soon).

This is simply _horrible_: module-level monkey patching. In other words:
huge side effects. I don't think this solution is acceptabe, and I'd like
this bug reopened, admitedly with a milestone set for later than 0.10.

The IPython-related code in ETS is full of similar hacks (like
monkey-patching raw_input). It renders the whole applications fragiles.

Gaël

On Sun, Mar 15, 2009 at 2:27 PM, Gael Varoquaux
<email address hidden> wrote:

> This is simply _horrible_: module-level monkey patching. In other words:
> huge side effects. I don't think this solution is acceptabe, and I'd like
> this bug reopened, admitedly with a milestone set for later than 0.10.

I agree that it's horrible. A proper solution would be to implement
the crash handler as a hook (and have current crash handler as the
default handler if hook raises TryNext).

--
Ville M. Vainio
http://tinyurl.com/vainio

On Sun, Mar 15, 2009 at 12:42:19PM -0000, Ville M. Vainio wrote:
> On Sun, Mar 15, 2009 at 2:27 PM, Gael Varoquaux
> <email address hidden> wrote:

> > This is simply _horrible_: module-level monkey patching. In other words:
> > huge side effects. I don't think this solution is acceptabe, and I'd like
> > this bug reopened, admitedly with a milestone set for later than 0.10.

> I agree that it's horrible. A proper solution would be to implement
> the crash handler as a hook (and have current crash handler as the
> default handler if hook raises TryNext).

That sounds good.

Gaël

Fernando Perez (fdo.perez) wrote :

Reopened as per feedback in thread. We'll look into it post-0.10 though.

Changed in ipython:
importance: Undecided → High
status: Won't Fix → Triaged
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers