DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Capture And Email A Traceback In Python
import traceback, smtplib, StringIO fp = StringIO.StringIO() traceback.print_exc(file=fp) message = fp.getvalue() server = smtplib.SMTP(FAILURE_SERVER) server.sendmail( FAILURE_FROM, FAILURE_TO, FAILURE_MESSAGE + '\n\n' + message, ) server.quit()






Comments
Snippets Manager replied on Mon, 2012/05/07 - 2:23pm
Snippets Manager replied on Mon, 2006/06/12 - 10:35am