AnsweredAssumed Answered

IndexError: list index out of range

Question asked by Zemregulus on Nov 24, 2018
Latest reply on Nov 24, 2018 by Dan_Patterson

I'm getting an IndexError saying it's out of range. But the Westerville dataframe is the first one and I'm using 0 to refer to it. After I run the program the cursor is at the end of the bolded line. What is Python trying to tell me? 

 

mxd = arcpy.mapping.MapDocument(r"E:\EsriTraining\ArcPy\MapScripting\Exercise3\Westerville.mxd")
# return a list of all data frames in the mapping doc and assign it to df
df = arcpy.mapping.ListDataFrames(mxd)[0]
print df.name
lyr = arcpy.mapping.ListLayers(mxd, " ", df)[1]

Outcomes