Solved

Automatically forward errors via email

Posted on 2011-09-12
5
375 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Bulk Reorder File Names 4 69
yara deployment 8 78
Does python 2.7 include encryption library by default? 2 37
python - user input - set 4 29
Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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