I need to update a text element in a group of MXDs that I manage. That element, however, is locked in the layout using the lock function from the Production Cartography tool. Using python, is there a way to unlock this text element? In testing, I've found that once it is unlocked I'm able to access the element's content and update it.
Here's the basic code snippet that I'm using:
mxd = arcpy.mapping.MapDocument(md) for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"): if elm.name == "CompantyTxt": elm.text = "New Text to Replace the Old Text" mxd.save()
I can run this code with the desired text element getting updated if the element is not locked. With it locked, however I get the following runtime error:
"File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects_base.py", line 87, in _set return setattr(self._arc_object, attr_name, cval(val)) RuntimeError: TextElementObject: Error in setting text"