-
Notifications
You must be signed in to change notification settings - Fork 7
Home
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.
h3. Modules
h3. Misc Notes
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()