I'm trying to remove a layer from my map. this code:
gets me this result:
[<map layer u'StruxPts_v04'>, <map layer u'Land_Projects_Parcels_P6'>]
StruxPts_v04
[<map layer u'StruxPts_v04'>, <map layer u'Land_Projects_Parcels_P6'>]
As you can see, the layer 'StruxPts_v04' was not removed. When does this sort of thing occur?
Thanks!
EDIT: I'm thinking it has something to do with my searchcursor. addstru is searched, but I delete the cursor's variables prior to the code above.
Code:
arcpy.AddMessage(str(arcpy.mapping.ListLayers (mxd, "", df)))
arcpy.AddMessage(addstru)
arcpy.mapping.RemoveLayer (df, addstru)
arcpy.AddMessage(str(arcpy.mapping.ListLayers (mxd, "", df)))
[<map layer u'StruxPts_v04'>, <map layer u'Land_Projects_Parcels_P6'>]
StruxPts_v04
[<map layer u'StruxPts_v04'>, <map layer u'Land_Projects_Parcels_P6'>]
As you can see, the layer 'StruxPts_v04' was not removed. When does this sort of thing occur?
Thanks!
EDIT: I'm thinking it has something to do with my searchcursor. addstru is searched, but I delete the cursor's variables prior to the code above.