[IPython-user] Re: IPython Crash Report

Fernando Perez fperez at colorado.edu
Mon May 12 20:02:34 CDT 2003


Hi Gary,

> Sorry, I meant to attach it before. Here it is. Run it and hit any key 
> to bring on the crash. I raise a non-existent exception.

Sorry, but I think I'm going to have to punt this one.  I'm strongly convinced 
that it's an issue related to threading behavior: in its own thread, wxWindows 
is somehow passing control of the exceptions to sys.excepthook instead of the 
normal exception handling which is built into ipython.  You'll notice that 
ipython doesn't really crash, since when the wxApp returns, the ipython prompt 
is back.

I know that running wxWindows apps under a normal python prompt is _extremely_ 
difficult.  I tried running your file with a normal prompt and I still get 
somewhat similar behavior, it's just that in this case, sys.excepthook is a 
python builtin and not the IPython Crash handler.

I know this stuff is very tricky, b/c the SciPy folks have a fairly funky 
system for trying to enable wxWindows plotting from a normal python prompt. 
Lately I think they've mostly punted the issue too, resorting to using PyCrust 
for interactive work which involves wxWindows.  Since PyCrust is itself 
wxWindows based, it seems to work better.

I'm not saying that I wouldn't like to see this issue solved, but I don't even 
know if it admits a clean solution at all.  The MainLoop() call seems to 
create its own thread where it bypasses all of ipython's exception handling, 
so I just don't know what to do.  IPython still catches exceptions via 
sys.excepthook, but that's been set to look like it crashed, because normally 
it only gets reached by otherwise uncaught exceptions, which signal a crash.

One kludgy solution is to reset sys.excepthook when using wxWindows:

sys.excepthook = sys.__excepthook__

With this method you lose IPython's automatic crash reports, but otherwise 
normal exception handling remains, and wxWindows exceptions will go to the 
python builtin handler.

This is the best I can think of now.  If you (or anyone else on the list) have 
any ideas on how to go forward with this issue, I'd be glad to hear about 
them.  I don't use wxWindows myself and I know little about threading, so I 
may be missing something blindingly obvious.

Cheers,

f.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: try1.py
Type: text/x-python
Size: 484 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/ipython-user/attachments/20030512/3cc9fd3c/attachment.py 


More information about the IPython-user mailing list