AnsweredAssumed Answered

Moving Layout elements in ArcMap using Python

Question asked by crazymatt on Jun 10, 2013
Latest reply on Jan 20, 2014 by ajbrachman88
I'm having some severe difficulties trying to move graphics and text elements in layout using Python. I figured it would be pretty simple, just access the layout elements and change the anchor point. I copied this code from the help and changed it to reflect the filepath and element name in my map document:

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for elm in arcpy.mapping.ListLayoutElements(mxd, "GRAPHIC_ELEMENT"):
    if elm.name == "Title Block":
        elm.elementPositionX = 4.75
        elm.elementPositionY = 10.5
mxd.save()
del mxd

When I run it through a Python script tool or the Python window, I get this error message:

IOError: MapDocObject: Unable to save.  Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document.

I have read/write privileges and there is certainly enough disk space, so I don't know what the problem is. I tried commenting out the last two lines of code and it ran without errors, but the element I was trying to use didn't move. I suspect there is something very simple and silly happening here that I am missing.

Outcomes