Solved

Automatically forward errors via email

Posted on 2011-09-12
5
379 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article will show the steps for installing Python on Ubuntu Operating System. I have created a virtual machine with Ubuntu Operating system 8.10 and this installing process also works with upgraded version of Ubuntu OS. For installing Py…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to dynamically set the form action using jQuery.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

630 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