Solved

Automatically forward errors via email

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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Suggested Solutions

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…
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.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

738 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