arcpy.mapping.MoveLayer not working

Discussion created by gismarty on Jul 15, 2012
Latest reply on Apr 30, 2015 by TanyaKExp
Hi friends,

I am lucky to have found a solution to my previous problem, only through your kind help.

However, I have come across another one that leaves me just as dumbfounded.

Basically, I can't get arcpy.mapping.MoveLayer ( to work at all.

It seems like very simply syntax, yet it just refuses to move my layers.

At first, my own simple adaptation did not work,
arcpy.mapping.MoveLayer(df, "Contours 10m - MARANOA REGIONAL", "SPOT 2009 Image Date", "BEFORE")

so I tried based on their example

    for lyr in layerlist:
        if == "Contours 10m - MARANOA REGIONAL":
            moveLayer = lyr
        if == "SPOT 2009 Image Date":
            refLayer = lyr
        arcpy.mapping.MoveLayer(df, refLayer, moveLayer, "BEFORE")

and still the outcome is the same. The layer that is supposed to be moved just stays where it was introduced.

Has anyone come across this before or have any good tips for me?