<?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 Re: How to save opened mxd's using ArcPy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144666#M11229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I enter this line in:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mapdoc.save()
arcpy.env.overwriteOutput = True&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And got this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IOError: MapDocObject: Unable to save.&amp;nbsp; 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.&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:55:14 GMT</pubDate>
    <dc:creator>Yaron_YosefCohen</dc:creator>
    <dc:date>2021-12-11T07:55:14Z</dc:date>
    <item>
      <title>How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144661#M11224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I work on several open mxd's and i try to save them at once with arcpy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy,os,sys
import arcpy.mapping
from arcpy import env

env.workspace = r"D:\PROJECTS\bat_galim\gis"
for mxd in arcpy.ListFiles("*.mxd"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print mxd 
&amp;nbsp;&amp;nbsp;&amp;nbsp; mapdoc = arcpy.mapping.MapDocument(r"D:\PROJECTS\bat_galim\gis\\" + mxd)
&amp;nbsp;&amp;nbsp;&amp;nbsp; mapdoc.save()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'mapdoc.save'
&amp;nbsp;&amp;nbsp;&amp;nbsp; counter = counter + 1
del mxd
&lt;/PRE&gt;&lt;P&gt;but i get en error:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IOError: MapDocObject: Unable to save.&amp;nbsp; 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.&lt;/PRE&gt;&lt;P&gt;what wrong with my code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:55:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144661#M11224</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2021-12-11T07:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144662#M11225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;probably a path issues... for this ancient thread&lt;/P&gt;&lt;P&gt;see &lt;A href="https://community.esri.com/migration-blogpost/55463" target="_blank"&gt;Filenames and file paths in Python&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; mxd = "text.mxd"
&amp;gt;&amp;gt;&amp;gt; path = r"D:\PROJECTS\bat_galim\gis\\" + mxd
&amp;gt;&amp;gt;&amp;gt; path
'D:\\PROJECTS\\bat_galim\\gis\\\\text.mxd'&amp;nbsp;&amp;nbsp;&amp;nbsp; # hmmmmmmm
&amp;gt;&amp;gt;&amp;gt; path2 = r"D:\PROJECTS\bat_galim\gis" + "\\" + mxd
&amp;gt;&amp;gt;&amp;gt; path2
'D:\\PROJECTS\\bat_galim\\gis\\text.mxd'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:55:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144662#M11225</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T07:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144663#M11226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when i try to save opened MXD's i get an error. And my path is correct, so i don't see any reason to change it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 14:03:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144663#M11226</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2016-06-14T14:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144664#M11227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe try to set the workspace Overwrite property?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14659139662309484 jive_macro_code jive_text_macro" data-renderedposition="60_8_1332_16" jivemacro_uid="_14659139662309484"&gt;&lt;P&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 14:19:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144664#M11227</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2016-06-14T14:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144665#M11228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;and you confirmed that from my example... throw in a print statement and see what it returns and as James says, set overwriting to true&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 15:10:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144665#M11228</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-14T15:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144666#M11229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I enter this line in:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mapdoc.save()
arcpy.env.overwriteOutput = True&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And got this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IOError: MapDocObject: Unable to save.&amp;nbsp; 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.&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:55:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144666#M11229</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2021-12-11T07:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144667#M11230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it needs the full path to the mapdoc, or has to be 'current'.&amp;nbsp; If you don't have write permission for whatever reasons it throws the message.&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/mapdocument-class.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/mapdocument-class.htm"&gt;MapDocument—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 11:37:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144667#M11230</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-15T11:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144668#M11231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure where you placed the line (it looks like you put it in the for loop?), but it should probably be located just after you set the workspace:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;env.workspace = r&lt;SPAN class="string"&gt;"D:\PROJECTS\bat_galim\gis" &lt;/SPAN&gt;
&lt;SPAN class="string"&gt;env.overwriteOutput = &lt;SPAN class="special"&gt;True&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:55:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144668#M11231</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T07:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144669#M11232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i added it to this place- it still &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;throws the same message.&amp;nbsp; Maybe i wasn't clear in my question- the MXD's still open while i run this code. my propose was to save me to click on "save" buttun in all the open MXD's by my self- i wanted the python will do it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;so this what i did with this new row that James send me-there still an error. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 13:04:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144669#M11232</guid>
      <dc:creator>Yaron_YosefCohen</dc:creator>
      <dc:date>2016-06-15T13:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144670#M11233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code works fine for me.&amp;nbsp; Double-check the folder and file permissions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 13:26:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144670#M11233</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2016-06-15T13:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144671#M11234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if the project is open and you are trying to save it while it is open, you probably don't have permissions to do so at the operating level.... either close the project and just run the script, or change the name of the mxd to 'current'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:17:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144671#M11234</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-15T17:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144672#M11235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;my propose was to save me to click on "save" buttun in all the open MXD's by my self- i wanted the python will do it.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you are running the script from an Add-In tool?&amp;nbsp; I don't think it is possible to execute this type of save method from a script running parallel to the mxd document you are trying to alter --- I'd think there will be 2 separate instances of python conflicting. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will likely have to check to see if an .mxd referenced in your for loop is open and perform a saveAs instead. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:38:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144672#M11235</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2016-06-15T18:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to save opened mxd's using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144673#M11236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree, you cannot save or delete the mxd because it is opened. You stated they are all opened. I imagine&amp;nbsp;you are running this from the python window within an arcMap session. In this case the session thinks those files are opened, they are not the current document. If you want to save the current document, then you have to locate the save command object, but it will only save the current document.&lt;/P&gt;&lt;P&gt;As James suggested, you could use a saveAs, and then use an OS command to force ArcMap windows to close. It is not clean.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2016 20:06:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-opened-mxd-s-using-arcpy/m-p/144673#M11236</guid>
      <dc:creator>MarielaDel_Rio</dc:creator>
      <dc:date>2016-08-24T20:06:29Z</dc:date>
    </item>
  </channel>
</rss>

