To capture the traceback, so to put it in a log, I use this import traceback
def get_traceback(): # obtain and return the traceback exc_type, exc_value, exc_traceback = sys.exc_info() return ''.join(traceback.format_exception(exc_type, exc_value, exc_traceback)) Suppose I have a script run by the scheduler, this captures the traceback form any problems and emails them. if __name__ == '__main__': try: Runs_unattended() except: send_mail(send_from = yourEmailAddress, send_to = [ yourEmailAddress ], subject = 'Runs_unattended', text = '%s' % get_traceback(), files = [], server=yourLocalSMTP) -- http://mail.python.org/mailman/listinfo/python-list