vendredi 26 décembre 2014

How to get a ArcGIS custom tool to run fom command line?


I have been experimenting with ESRI's CalculateArea custom tool and it works fine running within ArcGIS from a toolbox. Then I wanted to see if I could run it as a standalone script from the commandline like this:



c:\Python27\ArcGIS10.1\python.exe calcAreaTest.py


calcAreaTest.py



import arcpy
arcpy.AddToolbox(r"D:\Toolbox.tbx")
arcpy.CalculateArea(r"D:\data.gdb\data", "Area")


The following error occurs:



Traceback (most recent call last):
File "D:\calcAreaTest.py", line 3, in <module>
arcpy.CalculateArea(r"D:\data.gdb\data", "Area")
File "D:\Toolbox.tbx", line 25, in CalculateArea
arcgisscripting.ExecuteError: ERROR 000582: Error occurred during execution.


I can paste the same code from calcAreaTest.py into the ArcGIS Python code window and it works. Anybody know how I can get it to work from the commandline?


Here is the link to the source code of the GPCalculateArea tool. GPCalculateArea custom tool





Aucun commentaire:

Enregistrer un commentaire