[IPython-dev] Preventing "Oops, IPython crashed" ?
Fernando.Perez at colorado.edu
Tue May 31 14:10:25 CDT 2005
Hans Meine wrote:
> Hi again,
> I forgot to ask this question, related to my Qt experiments: I loaded some
> experimental GUI code, and noticed that exceptions resulting from GUI actions
> result in this very verbose IPython traceback / bugreporting output.
> Is there a way to get a similar traceback to the one I get when calling
> functions manually from within IPython?
Not that I know. Unfortunately, exceptions raised in a different thread
propagate all the way through to sys.excepthook, which is the ipython
crash handler. And I don't know of a way at that point of identifying
whether the exception was caused by ipython code or by user code, so the
crash handler just does its job and prints that monster traceback.
This really annoys me a lot, but from all the googling and reading of
maling lists which I did, it seemed to me that cross-thread exception
handling in python was just somewhat limited. I'd love to learn of a
way around this problem, though, so by all means let me know if you are
aware of a viable solution.
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
More information about the IPython-dev