Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

ArcPy FeatureSet load error when run in geoprocessing service from client

$
0
0
Good day,

I'm trying to get a geoprocessing service to work. The service runs fine from ArcCatalog when I'm on the server, it produces the expected results. Once published though, I cannot get it to run from the endpoint. It seems that a part of my python code is responsible. Basically, I have this simple piece of code that is supposed to look for a file on the disk and return it as a Feature Class :
Code:

import arcpy
LayerName = arcpy.GetParameterAsText(0)
path = "C:\\PathToDatabase\database.gdb\\"
fs = arcpy.FeatureSet(path + LayerName)
arcpy.SetParameterAsText(1, fs)

When I execute the service from the endpoint I get this message :

Unable to complete operation.
Error executing tool.: Traceback (most recent call last): File "C:\PathToService\SearchByFeaturesTest.GPServer\extracted\v101\GetFileLocation.py", line 13, in <module> fs = arcpy.FeatureSet(path + LayerName) File "c:\program files\arcgis\server\arcpy\arcpy\arcobjects\mixins.py", line 1007, in __init__ self._arc_object.load(table) RuntimeError: RecordSetObject: Cannot open table for Load Failed to execute (Get Source FeatureSet). Failed to execute (SearchByFeaturesTest). Failed to execute (Search By Features Test).

When I look at the extracted py file in the task folder (C:\PathToService\SearchByFeaturesTest.GPServer\extracted\v101\GetFileLocation.py), I can see that lines have been added to my original py file:
Code:

# Esri start of added variables
import os, arcpy
g_ESRI_variable_1 = os.path.join(arcpy.env.packageWorkspace,u'database.gdb')
# Esri end of added variables

# Esri start of added imports
import sys, os, arcpy
# Esri end of added imports

import arcpy
LayerName = arcpy.GetParameterAsText(0)
path = g_ESRI_variable_1
fs = arcpy.FeatureSet(path + LayerName)
arcpy.SetParameterAsText(1, fs)

I am truly stumped on this problem and I could realy use a hand, can anyone help?

Thanks

Bruno

Viewing all articles
Browse latest Browse all 2485

Trending Articles