You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scott Davis edited this page Dec 19, 2013
·
2 revisions
To install the agrc python package you need to copy/checkout this folder in svn: http://subversion.dts.utah.gov/agrc-python/trunk/agrc to %PYTHONINSTALL%\Lib\site-packages (e.g. C:\Python27\ArcGIS10.1\Lib\site-packages). This will allow you to import the agrc package or individual modules without having to modify the python search path.
There are two ways to import:
import agrc.logging
will import just the specific module or
import agrc
will import all of the modules
After importing you can create new classes by using the new keyword:
logger = agrc.logging.Logger()
I did make a agrc93 package for 9.3 machines. The API is the same.
The LocalScripts folder is intended to be a local folder where scripts can be stored that are specific to the server. I thought that this would be a good standard place so that they were relative to our other python stuff. *.py is ignored in the folder in svn.
h3. Examples
Catching Errors
except arcpy.ExecuteError as e:
logger.logMsg('arcpy.ExecuteError')
logger.logError()
logger.logGPMsg()
emailer.sendEmail(logger.scriptName + ' - arcpy.ExecuteError', logger.log)
raise e
except Exception as e:
logger.logError()
emailer.sendEmail(logger.scriptName + ' - Python Error', logger.log)
raise e
finally:
logger.writeLogToFile()