Unable to find TEXT_ELEMENTs with ListLayoutElements()

Discussion created by cms on Dec 15, 2011
Latest reply on Dec 2, 2013 by cshore11
I'm fairly experienced with Python, but am new to arcpy, and have moderate skill with ArcMap. What I'm trying to do seems simple, but I've been unable to find a good example either in ESRI documentation or in the Forums.

What I want to do is replace the contents of a text label on a map, using arcpy. Perhaps I'm misunderstanding, but what I have done for this part of the project is to add a text label to the mxd file, using ArcGIS, with a generic piece of text, a label (and name) of "Title," and the text formatting that I want. The arcpy script does quite a few other things, but when it comes time to update the title (with a couple of time/date lines), nothing all. It doesn't even find the TEXT_ELEMENT that I expected. I've even tried using ...ListLayoutElement(mxd, "TEXT_ELEMENT") in ArcGIS' Python window, where mxd refers to "CURRENT." Nothing. The response is an empty list.

Here's the relevant part of my script:
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
    print "***DEBUG***: text element '' = %s" % (
    if == "Title":
        elm.text = elm.text.replace("Title", title)

The "DEBUG" line doesn't show up in the Python output, and the text is not changed on the resulting map later on (which is an exported GIF image).

Thanks in advance if anyone can help out with this.