<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Writing to Map Document Properties with Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596507#M46675</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;file = r"\\SUTCLIFFER-NEW\C$\Users\rsutcliffe\Desktop\Untitled.mxd" mxd = arcpy.mapping.MapDocument(file) mxd.title = '' #Additional lines tried mxd.save del mxd&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I noticed the following posts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first is about trouble writing to the map document properties in a "Save As":&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/29952-Accessing-Map-Document-Properties-via-arcpy.mapping?highlight=title+write" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/29952-Accessing-Map-Document-Properties-via-arcpy.mapping?highlight=title+write&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/38202-Script-Error-Populating-mxd-document-properties-with-arcpy.mapping-module?highlight=title+write" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/38202-Script-Error-Populating-mxd-document-properties-with-arcpy.mapping-module?highlight=title+write&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any thoughts, advice are welcome. Thanks in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ryan Sutcliffe&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Nov 2012 12:01:33 GMT</pubDate>
    <dc:creator>RyanSutcliffe</dc:creator>
    <dc:date>2012-11-28T12:01:33Z</dc:date>
    <item>
      <title>Writing to Map Document Properties with Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596507#M46675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;file = r"\\SUTCLIFFER-NEW\C$\Users\rsutcliffe\Desktop\Untitled.mxd" mxd = arcpy.mapping.MapDocument(file) mxd.title = '' #Additional lines tried mxd.save del mxd&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I noticed the following posts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first is about trouble writing to the map document properties in a "Save As":&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/29952-Accessing-Map-Document-Properties-via-arcpy.mapping?highlight=title+write" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/29952-Accessing-Map-Document-Properties-via-arcpy.mapping?highlight=title+write&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/38202-Script-Error-Populating-mxd-document-properties-with-arcpy.mapping-module?highlight=title+write" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/38202-Script-Error-Populating-mxd-document-properties-with-arcpy.mapping-module?highlight=title+write&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any thoughts, advice are welcome. Thanks in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ryan Sutcliffe&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 12:01:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596507#M46675</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2012-11-28T12:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Map Document Properties with Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596508#M46676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Works fine for me on 10.0 SP3. What version/SP are you running?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 12:25:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596508#M46676</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-11-28T12:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Map Document Properties with Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596509#M46677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just switched to ArcGIS Desktop 10.1 Service Pack 1. When a machine gets available I'll see if I can replicate the issue on a 10.0 machine...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ryan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 12:29:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596509#M46677</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2012-11-28T12:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Map Document Properties with Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596510#M46678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Worked fine for me in Desktop 10.1 SP1 as well. May be an issue with your mxd, have you tried it on more than one? Or have you tried making a new mxd and just putting in a title, saving it then seeing if you can modify it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 12:50:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596510#M46678</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-11-28T12:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Map Document Properties with Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596511#M46679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for testing on ArcGIS 10.1 for me. I have indeed tried on a bunch of mxds locally and on our server. I just created a new blank document now again and the same thing happens. I have the same issues for any of the map document properties like mxd.author. I just installed ArcGIS 10.1 so I'm going to test out a few other things and see if maybe something more general is wrong from the installation (python, read/write permissions). Unfortunately I don't have anyone else in office on 10.1 yet so can't just quickly test on another machine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Will post back with what I find out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ryan&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ps. Just a note. I am running the above code in Pythonwin not from within ArcMap.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 13:17:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596511#M46679</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2012-11-28T13:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Map Document Properties with Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596512#M46680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't have pythonwin. I tested in IDLE and pyscripter.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 15:43:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596512#M46680</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-11-28T15:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Map Document Properties with Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596513#M46681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I realized that the mxd.save command was not causing the save to occur and that I could actually affect the mxd title property within the map if I saved it manually after. Checked with ESRI Canada and the support person reminded me that the () after the mxd.save method was crucial and causing the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thus, the following code will do the trick:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;file = r"\\SUTCLIFFER-NEW\C$\Users\rsutcliffe\Desktop\Untitled.mxd" mxd = arcpy.mapping.MapDocument(file) mxd.title = "" #Don't forget those brackets! mxd.save() del mxd&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Simple syntax error. Thanks for your help Mathew, thanks for your help Jonothan H. at ESRI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ryan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Nov 2012 17:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596513#M46681</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2012-11-29T17:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Map Document Properties with Python</title>
      <link>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596514#M46682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Must have had my blinders on, didn't even notice you left that out of the code you posted.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Nov 2012 18:23:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-to-map-document-properties-with-python/m-p/596514#M46682</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-11-29T18:23:55Z</dc:date>
    </item>
  </channel>
</rss>

