ArcPy FeatureSet load error when run in geoprocessing service from client

5406
3
12-18-2012 10:11 AM
BrunoSt-Aubin1
New Contributor
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 :

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

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


[INDENT]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).[/INDENT]


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:

[INDENT]
# 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)
[/INDENT]

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

Thanks

Bruno
Tags (2)
0 Kudos
3 Replies
BrunoSt-Aubin1
New Contributor
After searching some more, it seems that the following thread may be related to my issue :

http://forums.arcgis.com/threads/73207-Publishing-PYT-with-a-string-pointing-to-an-SDE-file-on-disk-...
0 Kudos
ChristinaMosnick
New Contributor II

Here is the updated link I believe.

0 Kudos
BrunoSt-Aubin1
New Contributor
After following some steps by the other poster in the thread mentionned, I managed to work around the path problem. However, it seems that I may now have an environment problem :

[INDENT]Unable to complete operation.
Error executing tool.: ERROR 000229: Cannot open C:\arcgisserver\directories\arcgisjobs\pathToService\je21b3d49f57f48609764fb57a445bc02\scratch\scratch.gdb\FEATURECLASS Failed to execute (Make Source Feature Layer). Failed to execute (SearchByFeaturesID). Failed to execute (Search By Features ID).[/INDENT]

Indeed, on the server, I cannot find any path named C:\arcgisserver\directories\arcgisjobs\pathToService\je21b3d49f57f48609764fb57a445bc02\scratch\scratch.gdb\FEATURECLASS. My instinct tells me it has something to do with the environments but I have no clue how to fix it.

Help is still needed, thanks!

Bruno
0 Kudos