Dabo in 30 seconds?

Paul McNett p at ulmcnett.com
Tue Aug 2 14:00:47 EDT 2005


Fernando Perez wrote:
> <plug, but hopefully a useful one>
> 
> You may want to steal the crash handling code from ipython.  In order to
> address this kind of problem, ipython sticks an exceptionally verbose
> traceback printer into sys.excepthook.  If ipython ever crashes, the user gets
> a LOT of info, and it's all packaged ready to go, to be emailed to me.  Here's
> an example of the result (I stuck 1/0 inside to force the crash):

[snip]

> This approach has worked very well for me over the years, and these crash
> report emails have become fortunately rather rare as of late :)
> 
> If you are interested, just get ipython and grab the files for this, it's all
> BSD licensed.  You can also browse the SVN repo here if you want to look at
> the code:
> 
> http://ipython.scipy.org/svn/ipython/ipython/trunk/IPython/
> 
> The relevant files are ultraTB.py and CrashHandler.py.

Thanks Fernando, consider your excellent code stolen! :) I'll probably 
make a flag that defaults to ultraTB but that can also be set to leave 
sys.excepthook as-is. Best of both worlds!

I've done things like this in the past, in my own Visual Foxpro 
framework. In that situation, I had enough control over the deployment 
to also ship a small smtp client, and automatically email the error 
without requiring any interaction at all. Clients were impressed when 
I'd already have a fix for the problem before they even notified me of 
the issue!

-- 
Paul McNett
http://paulmcnett.com




More information about the Python-list mailing list