AnsweredAssumed Answered

List Index Out of Range?????

Question asked by MLCouden on May 10, 2013
Latest reply on May 10, 2013 by MLCouden
Can anyone tell me what "List Index Out of Range" means??  Thanks!!

import arcpy, traceback from arcpy import env  mxd = arcpy.mapping.MapDocument("CURRENT")  # Join Fields fc = r'K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\Traffic_Count_Data\2011_Counts\2011_Annual_Stations\Annual_Stations_2011.shp' fc2 = r"K:\TASS\2 - GEO-DATA PROCESSING SUPPORT\MICHELLE'S WORK_ENTER NOT!!\Work Folder\Python Programming\Annual_Stations.shp" inFeatures = "Annual_Stations" Table = "AADT"  fields_to_join = ['!F2011_TRAF!', '!FLAG!'] arcpy.AddField_management(fc, 'COUNT', 'TEXT') arcpy.CalculateField_management(fc, 'COUNT', 'str(!F2011_TRAF!) + str(!FLAG!)', 'PYTHON')  fields_to_join = ['!CURRENT_YE!', '!T_FLAG!'] arcpy.AddField_management(fc2, 'TRAFFIC', 'TEXT') arcpy.CalculateField_management(fc2, 'TRAFFIC', 'str(!CURRENT_YE!) + str(!T_FLAG!)', 'PYTHON')  lstLayers = arcpy.mapping.ListLayers(mxd)  flayer = arcpy.mapping.ListLayers(mxd, "AADT")[0] alayer = arcpy.mapping.ListLayers(mxd, "Annual_Stations")[0]  # Search Joined  FRows = arcpy.SearchCursor(flayer) ARows = arcpy.SearchCursor(alayer)  ffields = arcpy.ListFields(flayer, "COUNT", "String") afields = arcpy.ListFields(alayer, "TRAFFIC", "String")  FList = [] AList = []  for row in FRows:     Fvalue = row.getValue("COUNT")     FList.append(str(Fvalue))  for row in ARows:     Avalue = row.getValue("TRAFFIC")     AList.append(str(Avalue))  matched = set(FList) & set(AList)  for x in matched:     exp = '"TRAFFIC" = ' + "'" + x + "'"     arcpy.SelectLayerByAttribute_management("Annual_Stations", "ADD_TO_SELECTION", exp)     arcpy.SelectLayerByAttribute_management("Annual_Stations", "SWITCH_SELECTION") 

Outcomes