3

I have a Python Script that inserts X,Y Point in the SDE Point Feature Class. It works fine when executed in ArcMap 10.2, but it fails with IOError when published as Geoprocessing Task service in ArcGIS Server 10.2

Create Location Python Script

It does not make sense to me why!?

ArcGIS 10.2 Server Log IOError

Any ideas what might be and how to fix it? Thank You.

1

First of all, I am not sure if publishing a script that works directly with arcgisscripting is a good idea. I would recommend using arcpy instead (yes, it does go to the arcgisscripting and uses it, but I believe there is some logic that encapsulates this process and makes it work nicely when publishing a GP service in Server 10.1+).

Second, you are exposing a FeatureClass as a parameter, however, a feature class object cannot be used directly in the GP service as an input parameter. Your alternative is to either hard-code it as:

fc = r"C:\GIS\data.sde\myfc"

or use os.path.join (you would need to get just a name of the fc from a user, not the full path, or parse the full path and obtain just the name of fc in the code):

sdeworkspace = r"C:\GIS\data.sde"
fc = arcpy.GetParameterAsText(0) 
fcinsdeworkspace = os.path.join(sdeworkspace,fc)

This is the approach recommended and I use it myself, it works fine.

  • I hardcoded the FeatureClass as paramether. It works now. Thanks Alex. The strange part was that same script worked fine in ArcGIS 9.3 without any issues. – mitaka Nov 1 '13 at 17:57
1

In details how to hardcode the FeatureClass parameter as a constant value input:

  1. Make sure the paramether DataType is "Feature Class" Parameter Properties
  2. Browse the network path to the sde connection and the Feature Class Network path to SDE
  3. Set up the Input Mode of the FeatureClass parameter in the Service Editor as "Constant Value" Input Mode - constant value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.