Why cant I use SelectLayerByAttribute_management while a cursor is set

المشرف العام

Administrator
طاقم الإدارة
I've been having a problem with arcpy in that the simple line:

arcpy.SelectLayerByAttribute_management ("TEMP_LINES")produces this response: Runtime error : ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute).

Ive worked out that this error only occours when a cursor is set, like this:

lineCursor = arcpy.UpdateCursor("TEMP_LINES","","","combined_i")Can I not use select by attribute and the cursor or do I have one of them set up wrong?

EDIT: whole code:

arcpy.MakeFeatureLayer_management (Lines,"TEMP_LINES")lineCursor = arcpy.UpdateCursor("TEMP_LINES","","","combined_i")for row in lineCursor: arcpy.SelectLayerByAttribute_management ("TEMP_LINES") arcpy.SelectLayerByLocation_management (Polygons, "INTERSECT", "TEMP_LINES") arcpy.FeatureClassToFeatureClass_conversion (Polygons, "temp_polys") polyCursor = arcpy.SearchCursor("temp_polys") blocks_list = [] for row in cursor: blocks_list.append(row.getValue("BLOCK")) blocks_str = ', '.join(blocks_list) lineCursor.BLOCK = blocks_str

أكثر...
 
أعلى