Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

problem with arcpy.mapping.RemoveLayer

$
0
0
I'm trying to remove a layer from my map. this code:

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)))

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.

Viewing all articles
Browse latest Browse all 2485

Trending Articles