Although I ran this script successfully from ArcCatalog, for some reason the file path I'm providing to arcpy.MakeFeatureLayer() changes whenever I run it as a geoprocessing service on ArcGIS Server.
Here are the snippets that lead to this error:
##buildRegQuery.py
[...]
path = os.path.join(root_path, r'Zips\esriZipsLayer_NAD83.shp')
geometry = regUtil.parse_geometry(coords)
regUtil.pull_attributes(3, path, geometry, '0.25 miles')
[...]
##regUtil.py
def pull_attributes(idx, path, geometry, distance):
search_cursor = select_by_location(path, geometry, distance)[...]
def select_by_location(tiger_data_path, geometry, distance):
arcpy.MakeFeatureLayer_management(tiger_data_path, 'tigerLayer') ##throws error
arcpy.SelectLayerByLocation_management('tigerLayer', 'INTERSECT', geometry, distance)
return arcpy.da.SearchCursor('tigerLayer', '*')
Once this code is copied to the local drive of the server (via creating geoprocessing service), it seems to be looking on the server for the data not on the machine I specified in the path. Regarding my original post, I have already set the permissions on the file server hosting the data for the publisher server to access the data by following these instructions. But I'm still getting the same error and I don't feel like that explains why MakeFeatureLayer is getting a file path on the local drive when I'm explicitly providing it as input in my script.
Here is the stack trace:
Where is root_path being set and how is it being set?
It's a UNC to a folder on another server
root_path = r'\\NewCaspian\BanksNew\Data\tiger\TigerData'