Custom Python tool Execution failure

780
3
09-11-2012 04:01 AM
OlliWirpi
New Contributor
I've written couple of Python scripts that make operations to featurelayers and a table. Mostly some CRUD-operations based on the input of tools. Tools work well when they are executed from command line or in ArcMap. However, when published as a Geoprocessing service in ArcGIS server, they all fail to execute. According to ArcGIS server log, the problem is on creating Cursor objects:

 Executing (InsertRow): InsertRow 1 1 aaa # 2 1.1.2001 1.1.2001 # # # # A # # 0 # # # # 1.1.2001 1.1.2001 1.1.2001 0 0 0 # 0 Start Time: Tue Sep 11 14:09:26 2012 Running script InsertRow... : "C:\Documents and Settings\Administrator.ARCGIS\Application Data\ESRI\Desktop10.0\ArcCatalog\arcdata02.sde\sde.SDE.mobile\sde.SDE.task2" does not exist Failed to execute (InsertRow). Failed at Tue Sep 11 14:09:26 2012 (Elapsed Time: 0,00 seconds)


I've tried to with different forms of the connection string (absolute path to sde file, Path starting with "Database connection/<dataset name>/<feature class>), but none of these works.

Any ideas to make the script work? I'm running ArcGIS server version 10.0.
0 Kudos
3 Replies
MathewCoyle
Frequent Contributor
ArcServer editing requires at least a ArcServer Standard license I believe.
http://www.esri.com/software/arcgis/arcgisserver/features/functionality-table

If you have that, it looks like your SDE connection file is referenced to the local profile. I would imagine that isn't how you want to set it up on your server.
0 Kudos
OlliWirpi
New Contributor
The licence is ArcGIS Server Enterprise so that shouldn't be the problem.

Do you mean that the SDE file itself shouldn't be under local profile? I copied the file to the same directory where the Python files are, changed the script to use that file and tried again but came out with the same error.

arcpy.env.workspace = "arcdata02.sde"

updateCur = arcpy.UpdateCursor("sde.SDE.mobile\\sde.SDE.task", sql)
insertCur = arcpy.InsertCursor("sde.SDE.history\\sde.SDE.task_history")


I'm wondering why do the tools work when run from ArcCatalog, but not any more as published GPService.
0 Kudos
MathewCoyle
Frequent Contributor
ArcGIS Server Enterprise doesn't tell you your license level, just the number of licenses and servers you can deploy to.

http://www.esri.com/software/arcgis/arcgisserver/features/functionality-table

Also make sure you use UNC paths when executing scripts on a server. You are getting a "does not exist Failed to execute" error, so it seems it can't find your data more than a license level problem.
0 Kudos