0

I have a script tool in ArcGIS Pro v3.3 to loop through a geodatabase of polygon feature classes and intersect each of them with another polygon dataset and then do some additional processing. Of the 14 intersect layers 12 of them work perfectly but two of them are throwing error 000840 (Value is not a feature layer). I cannot find any differences between the polygon layers that work and the 2 that throw the error. If I add a step to Make a Feature Layer to the script I get the same error, that the input is not (already) a feature layer. Any suggestions?

workSpace = arcpy.GetParameterAsText(0)
pestGDB = arcpy.GetParameterAsText(1)
inputFC = arcpy.GetParameterAsText(2) 
bufferDist = arcpy.GetParameterAsText(3)

workingGDB = os.path.join(str(pestGDB) + ".gdb")
projectBuffer = os.path.join(workingGDB, os.path.basename(inputFC) + "_PEST_RESULTS")

arcpy.analysis.Buffer(inputFC, projectBuffer, bufferDist)

pestLayers = os.path.join(workSpace, os.path.basename("PEST_Inputs.gdb"))
arcpy.env.workspace = pestLayers
pestList = arcpy.ListFeatureClasses()    
 

for fc in pestList:
    intersectResults = os.path.join(workingGDB, "intersect_" + str(fc))
    arcpy.analysis.Intersect([projectBuffer, fc], intersectResults)
0

1 Answer 1

2

It looks like it was not a scripting error but rather the fact that the datasets in question had not been added to the ArcGIS Pro project as feature layers like the others. As soon as I added those two layers to my ArcGIS Pro project the tool ran to completion without any issues. All of the datasets were in a geodatabase referenced by the script and not pulling from the APRX at all, so I do not understand this behavior but am happy to have found a solution.

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