Created
August 1, 2012 15:15
-
-
Save stdavis/3227713 to your computer and use it in GitHub Desktop.
try-except demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try: | |
| logger = agrc.logging.Logger() | |
| emailer = agrc.email.Emailer('stdavis@utah.gov') | |
| # do a bunch of cool stuff here | |
| except arcpy.ExecuteError: | |
| # catches arcpy errors. only works in 10 or later | |
| logger.logMsg('arcpy.ExecuteError') | |
| logger.logError() | |
| logger.logGPMsg() | |
| emailer.sendEmail(logger.scriptName + ' - arcpy.ExecuteError', logger.log) | |
| except: | |
| logger.logError() | |
| emailer.sendEmail(logger.scriptName + ' - Python Error', logger.log) | |
| print 'done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment