[IPython-dev] Preventing "Oops, IPython crashed" ?
Fernando Perez
Fernando.Perez at colorado.edu
Thu Aug 11 15:49:57 EDT 2005
Hans Meine wrote:
>>There is a workaround: you can manually reset sys.excepthook to the
>>ipython normal exception handler:
>>
>>sys.excepthook = __IPYTHON__.excepthook
>>
>>By running this line, you lose the real crash handler though, so if
>>ipython proper crashes, I will get a LOT less debug information. Caveat
>>emptor.
>
>
> I think this workaround should be documented somehow. When working with GUI
> callbacks that possibly result in exceptions in a different thread, the long
> traceback is much less helpful than the shiny "normal" IPython one.
> (Congratulations on that BTW.)
>
> Another workaround could be to color the long one, too (after all, it's mostly
> the missing color which bugs me), and either remove that from the report.txt
> or even send a colored report (although the usefulness depends on your mailer
> since it's not attached but in the mail body) which you can dump to a
> console?
The problem is that I have no way of knowing if that is being hit by a
matplotlib exception, or an honest ipython crash. Cross-thread exception
handling in python is a nightmare, so all those guys fall trhough into
sys.excepthook, where the ipython crash handler sits. That one doesn't use
color, because ansi escapes inside emails make a mess.
So I'm afraid I don't really know how to solve this particular problem
cleanly. Any ideas would be most welcome. Specifically, a way to trap the
mpl exceptions only would do the trick, but all try/excepts I've tried to wrap
around the mpl threads have so far failed.
My reading of multiple posts on c.l.py on the exceptions/threads mix make it
sound like it's a pretty explosive cocktail, so I really don't know what else
to do.
Cheers,
f
More information about the IPython-dev
mailing list