We have an insert script that runs fine on our server. When we publish it as a geoprocessing service, we get this error:
RuntimeError: cannot open '..\..\..\..\..\maptool\tools\spatialdb_spatialtest.sde\spatialtest.name.name_si' Failed to execute
In the script, the connection looks like this:
fc = r"C:\apps\maptool\tools\spatialdb_spatialtest.sde\spatialtest.name.name_si"
cursor = arcpy.da.InsertCursor(fc, ("subject_item_id", "address1", "address2", "city_name", "state_code", "zip_code"))
Any suggestions on how to troubleshoot and solve would much appreciated. I suspect the issue may be with the path? I'm not sure why all of the ..\..\ are showing up in the error message.
Thanks for the tip. The database connection was not registered with the Data Stores on the Server. We registered the connection, republished the service and are still getting an error. We also made sure that the server user has permissions on the folder. I looked at the file that was created when we published the tool and found this:
# Esri start of added variables
g_ESRI_variable_1 = u'..\\..\\..\\..\\..\\maptool\\tools\\spatialdb_spatialtest.sde\\spatialtest.name.name_si'
# Esri end of added variables
Any suggestions of what to try next?