jpedder

confusion with ListDataFrames and Listlayers

Discussion created by jpedder on Aug 22, 2012
Latest reply on Aug 22, 2012 by jpedder
I have a script that moves a group layer from one mxd to others, the layer is saved from the current mxd then written to a list of other mxd???s, the group layer is Base_Data.

My script is working well but I???d like to clean it up a bit by first removing any existing Base_Data layer groups in the target mxd before writing the layer source. As it is, if I run the script 3 time I get 3 copies of Base_Data in the target.

I???m trying to use the following but am seeing unexpected results.

Using the ListDataFrames function I assumed I???d get back a list of the DataFrames in the mxd, such as ???New Data Frame???
df = arcpy.mapping.ListDataFrames(mxd,"")[0]
instead when I iterate the list df I get a list of all the layers.
For i in df:
                Print i


So when I try to list the layers to select the Base_Data I just get a list of layers the first group layer 
basedata = arcpy.mapping.ListLayers(mxd)[0]
       for i in basedata:
                arcpy.AddMessage(i)



All I???m really trying to accomplish it to detete any layers in the target mxd that contain ???Base_Data???

Thanks

Outcomes