AnsweredAssumed Answered

SelectLayerbyLocation nested in SearchCursor

Question asked by qvt2_pdxedu on Jan 21, 2020
Latest reply on Jan 21, 2020 by bixb0012

Hi, I am getting an error when I try and run this code, but can't figure out why. Is there something I am missing? 

 

Thanks,

 

resultCoT = 'A'
with
arcpy.da.SearchCursor(inputpoints, '*') as pointList:
    for point in pointList:
        countTest = arcpy.SelectLayerByLocation_management(inputlines, "INTERSECT", point, "", "NEW_SELECTION")
        with arcpy.da.SearchCursor(countTest, '*') as lineList:
             for line in linelist:
                 if line[0] == 'PROPERTY':
                     count = count + 1
        if count == 2:
            resultCoT = 'B'
print(resultCoT)

 

The error I get at the SelectLayerByLocation tool line is:

RuntimeError: Object: Error in executing tool

 

Shows you how little I know. . . 

Outcomes