Solved

Automatically forward errors via email

Posted on 2011-09-12
5
372 Views
Last Modified: 2012-05-12
I want to run code inside my program that will record and send any error that occurs whether handled or not to me via email or some other method , but especially not handled... can you point me in a direction of and example
0
Comment
Question by:dolamitejenkins
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:mish33
ID: 36527646
Use try/except :
def myfunc():
  # to do something useful

try :
  myfunc()
except :
  # mail error
  sendmail(sys.exc_info())

Open in new window

0
 

Author Comment

by:dolamitejenkins
ID: 36529447
my program is about 2000 lines ... when people start using it How can I collect all the error that occur ... this seems to capture for one module... any thoughts ?
0
 
LVL 15

Accepted Solution

by:
mish33 earned 500 total points
ID: 36530010
Wrap your main function - it will catch all exceptions (in the main thread) in all modules.
0
 

Author Comment

by:dolamitejenkins
ID: 36531344
Thanks
0
 

Author Closing Comment

by:dolamitejenkins
ID: 36531835
thank you
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
python question 5 60
scripting, exchange 35 40
Python:Remove duplicates without sorting? 5 61
Example unit tests with AngularJS 3 8
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to dynamically set the form action using jQuery.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now