6

i have a scenario where some unknown exceptions may be raised during program execution and i can't except most of them and i want every time any exception will raise an email should send to me as exceptions cause program to terminate if not properly catch!

so i have read about python provide atexit module but it did not work with exceptions so my question is , is there any way to make atexit work with exceptions?? so every any exception raised and programs terminates it should send me a mail? thanks

maq
  • 1,175
  • 3
  • 17
  • 34
  • 2
    Related https://stackoverflow.com/questions/6234405/logging-uncaught-exceptions-in-python – dhke Jun 25 '15 at 20:55

1 Answers1

6

Look at sys.excepthook. As its name suggests, it's a hook into the exception. You can use it to send you an email when exceptions are raised.

DevShark
  • 8,558
  • 9
  • 32
  • 56