AnsweredAssumed Answered

Exception Raised on my for row command line?

Question asked by MLCouden on Apr 25, 2013
Latest reply on Apr 25, 2013 by MLCouden
I am gettin an exception raised on my for row command line and I think it is because I am not declaring my fields correctly. Would I use the ListFIelds command like shown or something else.

import arcpy  mxd = arcpy.mapping.MapDocument(r"K:\TASS\2 - GEO-DATA PROCESSING SUPPORT\MICHELLE'S WORK_ENTER NOT!!\Work Folder\Python Programming\Wayne's Tools\Abilene_Base_Map.mxd") lstLayers = arcpy.mapping.ListLayers(mxd)  flayer = arcpy.mapping.ListLayers(mxd, "AADT")[0] alayer = arcpy.mapping.ListLayers(mxd, "AADTAnnoLabel")[0]  FRows = arcpy.SearchCursor(flayer) ARows = arcpy.SearchCursor(alayer)  #ffields = arcpy.ListFields(mxd, "", "FLAG") #afields = arcpy.ListFields(mxd, "", "TFLAG")  FList = [] AList = []  for row in FRows:     Fvalue = row.getValue("FLAG")     FList.append(str(Fvalue))  for rows in ARows:     Avalue = row.getValue("TFLAG")     AList.append(str(Avalue))  matched = set(FList) & set(AList)  for x in matched:     exp = "ID = " + x     arcpy.SelectLayerByAttribute_management(flayer, "ADD_TO_SELECTION", exp)     arcpy.SelectLayerByAttribute_management(flayer, "SWTCH_SELECTION")