Nested loop Search Cursor in ArcPy

المشرف العام

Administrator
طاقم الإدارة
I'm trying to loop through each each row of a feature class, extract it as an individual feature, and then buffer it based of the value of an attribute ("best_buf" field). But the nested loop is giving an error:

Traceback (most recent call last): File "C:\GISwork\Bald_Eagle\oliver\emergent_select_loop.py", line 38, in for row2 in cursor2: RuntimeError: A column was specified that does not exist.

The code works without the outer loop, when I tested it with an individual feature. But adding the outer loop messes it up.

Here is my code:

fc1 = BEN_layer field1 = "UNIQUEID" cursor1 = arcpy.da.SearchCursor(fc1, (field1)) for id in cursor1: #extract out individual nest query = "UNIQUEID" + "=" + str(id[0]) arcpy.MakeFeatureLayer_management(BEN_layer, "BEN", query) BEN = "BEN" ##clip water to buffer size #access buffer size fc2 = BEN field2 = "best_buf" cursor2 = arcpy.da.SearchCursor(fc2, (field2)) for row2 in cursor2: water_buf_size = row2 #buffer nest #buf_size = str(water_buf_size) + str(Feet) arcpy.Buffer_analysis(BEN, "BEN_buf", water_buf_size)

أكثر...
 
أعلى