I want to wrap a whole script in try ... except. What is the best way of
doing this?
Consider the following: -
try:
import <modules>
<CODE>
def notifyme(traceback):
code to tell me there is a problem
except Exception, traceback:
notifyme(traceback)
Would this code not work because if any part of <CODE> encounters an
exception then it won't reach the notifyme() function definition and
therefore the whole thing won't work and I won't get notified when a
traceback occurs, in fact the call to notifyme() under except will
itself probably trace back as well!
Do I have to instead do:
import <a couple of modules>
def notifyme():
code to tell me there is a problem
try:
<CODE>
except Exception, traceback:
notifyme(traceback)
How you you handle this?
Hari