AnsweredAssumed Answered

Writing to Map Document Properties with Python

Question asked by ryan.sutcliffe on Nov 28, 2012
Latest reply on Nov 29, 2012 by mzcoyle
While working on some python scripts I quickly tried to erase the map title element via python using essentially the below code in a loop:

file = r"\\SUTCLIFFER-NEW\C$\Users\rsutcliffe\Desktop\Untitled.mxd" mxd = arcpy.mapping.MapDocument(file) mxd.title = '' #Additional lines tried mxd.save del mxd


Doing this returns no errors but once I recheck the mxd the values are not removed. This happens on every mxd I've tried/created. It seems I'm having trouble writing to this property: mxd.title. Is anyone able to spot what I'm missing?

I noticed the following posts:

The first is about trouble writing to the map document properties in a "Save As":
http://forums.arcgis.com/threads/29952-Accessing-Map-Document-Properties-via-arcpy.mapping?highlight=title+write

The second is someone reportedly having success editing the property by running the code from within the mxd itself which I am also not able to do even though the code is pretty much the same.
http://forums.arcgis.com/threads/38202-Script-Error-Populating-mxd-document-properties-with-arcpy.mapping-module?highlight=title+write

any thoughts, advice are welcome. Thanks in advance.

Ryan Sutcliffe

Outcomes