<?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: arcpy.mapping.MapDocument(“CURRENT”) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505421#M39749</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I saved the mxd. It is in the folder: C:\\temperature\\result\\mean.mxd&lt;/P&gt;&lt;P&gt;Here we go:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os, sys
import shutil
import arcpy
from arcpy import env
arcpy.CheckOutExtension("spatial")
from arcpy.sa import *
arcpy.env.overwriteOutput = True
start_date = arcpy.GetParameterAsText(0)
end_date = arcpy.GetParameterAsText(1) 
env.workspace = "c:/temperature/input"
rasters = arcpy.ListRasters("*","GRID")
for raster in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if int(raster) &amp;gt;= int(start_date) and int(raster) &amp;lt;= int(end_date):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRaster_management((raster), "c:/temperature/query/" + (raster) + ".tif", "", "", "", "NONE", "NONE", "", "NONE", "NONE")
env.workspace = "c:/temperature/query"
eredmeny = "c:/temperature/result/atlag.tif"
rasterses = arcpy.ListRasters("*","TIF")
result = arcpy.gp.CellStatistics_sa((rasterses), eredmeny, "MEAN", "DATA")
env.workspace = "c:/temperature/query"
rasters = arcpy.ListRasters("*","TIF")
for oldraster in rasterses:
&amp;nbsp; arcpy.Delete_management(oldraster)
env.workspace = "c:/temperature/result"
outInt = Int("atlag.tif")
outInt.save("c:/temperature/result/atlagint.tif")
env.workspace = "c:/temperature/result"
arcpy.RasterToPolygon_conversion("c:/temperature/result/atlagint.tif", "c:/temperature/result/atlagint.shp", "SIMPLIFY", "VALUE")


# get the map document
mxd = arcpy.mapping.MapDocument (r'C:\\temperature\\result\\mean.mxd')
# get the data frame
df = arcpy.mapping.ListDataFrames(mxd,"*")[0]
# create a new layer
newlayer = arcpy.mapping.Layer("c:/temperature/result/atlagint.shp")
# add the layer to the map at the top of the TOC in data frame 0
arcpy.mapping.AddLayer(df, newlayer, "TOP")
sourceLayer = "c:/temperature/result/symbology.lyr"
layerSymb = arcpy.mapping.Layer(sourceLayer) 
updateLayer = arcpy.mapping.ListLayers(mxd, "atlagint", df)[0] 
arcpy.mapping.UpdateLayer(df, updateLayer, layerSymb, "TRUE") 
arcpy.RefreshTOC()
arcpy.RefreshActiveView()


lyrFile = arcpy.mapping.Layer("c:/temperature/result/symbology.lyr")
for lyr in arcpy.mapping.ListLayers(lyrFile, "c:/temperature/result/atlagint.shp"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.saveACopy("c:/temperature/result/symbologyLabels.lyr")
exit()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:10:38 GMT</pubDate>
    <dc:creator>LaszloCsunderlik</dc:creator>
    <dc:date>2021-12-11T22:10:38Z</dc:date>
    <item>
      <title>arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505411#M39739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;Hi Guys!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;I am writing a web application for my thesis in ArcPy and I would like to share my script code with the Flex but I can't share my script as geoprocesing service. The warning message: 00068 Script Script contains broken project data source: CURRENT Here is the script, where the "CURRENT" mapping module is. See attached!! &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;It would be very helpful if someone could find a solution for this. This script is working prefectly in desktop, I just can't publish because this error message.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 17:41:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505411#M39739</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2015-05-21T17:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505412#M39740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "CURRENT" constant is for use while using ArcMap.&amp;nbsp; It isn't going to mean anything to your geoprocessing service.&amp;nbsp; You need to pass the path to an mxd document.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 17:51:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505412#M39740</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-05-21T17:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505413#M39741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But if i change the "CURRENT" part to the path, after the script doesn't load the result. Or should I change something more in the script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 18:50:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505413#M39741</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2015-05-21T18:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505414#M39742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you enclosing the path in quotes?&amp;nbsp; I believe it wants the path as a string and passing paths in python is tricky.&amp;nbsp; But something like r'C:\folder\filename.mxd' will work.&amp;nbsp; Or 'C:\\folder\\filename.mxd' or 'C:/folder/filename.mxd'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 19:55:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505414#M39742</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-05-21T19:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505415#M39743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, would you mind moving the original post to another Place on GEONet? None of this is related to Admin Tools for ArcGIS Online.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 20:21:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505415#M39743</guid>
      <dc:creator>NeillJobe</dc:creator>
      <dc:date>2015-05-21T20:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505416#M39744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I am encosing the path in quotes. I tried the path as a string, but none of your suggestion worked. Any idea? I didn't know that passing paths in python is so tricky. Or there is another problem in the script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 20:56:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505416#M39744</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2015-05-21T20:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505417#M39745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What error are you getting now?&amp;nbsp; Can you post your revised code using &lt;A _jive_internal="true" href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet"&gt;this method&lt;/A&gt; in a reply so it doesn't need to be downloaded?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 21:13:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505417#M39745</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-05-21T21:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505418#M39746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And you might want to &lt;A _jive_internal="true" href="https://community.esri.com/thread/121491"&gt;unmark this question as answered&lt;/A&gt; if you want others to chime in.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 21:16:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505418#M39746</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-05-21T21:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505419#M39747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First of all thanks for the usefull notes.&lt;/P&gt;&lt;P&gt;Unfortunately there is no error message, the script runs perfectly, but it doesn't show the result shp file. I checked&amp;nbsp; the path, and always there is the new shp, but the script doesn't add it to the TOC. I can't use the above mentioned method....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 21:39:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505419#M39747</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2015-05-21T21:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505420#M39748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Copy your code, paste it into a reply here on GeoNet, then click on "Use advanced editor" in the upper right hand side of your reply. Select the text of your code and click on &amp;gt;&amp;gt; above to the right of the smilies, hover over Syntax Highlighting and scroll down to python.&amp;nbsp; That way your code is formatted for display and allows a responder to read it and troubleshoot it without having to download.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It sounds like you aren't saving the mxd?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14322472944193279 jive_text_macro" data-renderedposition="134_8_913_16" jivemacro_uid="_14322472944193279" modifiedtitle="true"&gt;&lt;P&gt;mxd.save()&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 22:28:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505420#M39748</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-05-21T22:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505421#M39749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I saved the mxd. It is in the folder: C:\\temperature\\result\\mean.mxd&lt;/P&gt;&lt;P&gt;Here we go:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os, sys
import shutil
import arcpy
from arcpy import env
arcpy.CheckOutExtension("spatial")
from arcpy.sa import *
arcpy.env.overwriteOutput = True
start_date = arcpy.GetParameterAsText(0)
end_date = arcpy.GetParameterAsText(1) 
env.workspace = "c:/temperature/input"
rasters = arcpy.ListRasters("*","GRID")
for raster in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if int(raster) &amp;gt;= int(start_date) and int(raster) &amp;lt;= int(end_date):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRaster_management((raster), "c:/temperature/query/" + (raster) + ".tif", "", "", "", "NONE", "NONE", "", "NONE", "NONE")
env.workspace = "c:/temperature/query"
eredmeny = "c:/temperature/result/atlag.tif"
rasterses = arcpy.ListRasters("*","TIF")
result = arcpy.gp.CellStatistics_sa((rasterses), eredmeny, "MEAN", "DATA")
env.workspace = "c:/temperature/query"
rasters = arcpy.ListRasters("*","TIF")
for oldraster in rasterses:
&amp;nbsp; arcpy.Delete_management(oldraster)
env.workspace = "c:/temperature/result"
outInt = Int("atlag.tif")
outInt.save("c:/temperature/result/atlagint.tif")
env.workspace = "c:/temperature/result"
arcpy.RasterToPolygon_conversion("c:/temperature/result/atlagint.tif", "c:/temperature/result/atlagint.shp", "SIMPLIFY", "VALUE")


# get the map document
mxd = arcpy.mapping.MapDocument (r'C:\\temperature\\result\\mean.mxd')
# get the data frame
df = arcpy.mapping.ListDataFrames(mxd,"*")[0]
# create a new layer
newlayer = arcpy.mapping.Layer("c:/temperature/result/atlagint.shp")
# add the layer to the map at the top of the TOC in data frame 0
arcpy.mapping.AddLayer(df, newlayer, "TOP")
sourceLayer = "c:/temperature/result/symbology.lyr"
layerSymb = arcpy.mapping.Layer(sourceLayer) 
updateLayer = arcpy.mapping.ListLayers(mxd, "atlagint", df)[0] 
arcpy.mapping.UpdateLayer(df, updateLayer, layerSymb, "TRUE") 
arcpy.RefreshTOC()
arcpy.RefreshActiveView()


lyrFile = arcpy.mapping.Layer("c:/temperature/result/symbology.lyr")
for lyr in arcpy.mapping.ListLayers(lyrFile, "c:/temperature/result/atlagint.shp"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.showLabels = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.saveACopy("c:/temperature/result/symbologyLabels.lyr")
exit()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:10:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505421#M39749</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2021-12-11T22:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505422#M39750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN class="s1"&gt;try:&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s1"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="s2"&gt;FC = "&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;c:/temperature/result/atlagint.shp"&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;
 &lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;
&lt;SPAN class="s1"&gt;arcpy.MakeFeatureLayer_management(FC, &lt;/SPAN&gt;&lt;SPAN class="s3"&gt;newlayer&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;)
 &lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;
&lt;SPAN class="s1"&gt;arcpy.mapping.AddLayer(df, newlayer, "TOP")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:10:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505422#M39750</guid>
      <dc:creator>CarlSunderman</dc:creator>
      <dc:date>2021-12-11T22:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505423#M39751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried with this too, but it isn't working. I have no idea what can be the soluton for this, because it is just a simple "add shp to the TOC" and still it is the hardest part...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2015 16:41:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505423#M39751</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2015-05-25T16:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505424#M39752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5;"&gt;To save the changes within the mxd, you need a line of code within the script, you will also have to reopen the mxd after the script is run!:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL class="dp-py" start="1" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #5c5c5c; margin-bottom: 1px !important; margin-left: 45px !important;"&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;arcpy.RefreshTOC()&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;arcp.RefreshActiveView()&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important;"&gt;mxd.save()&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 14:04:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505424#M39752</guid>
      <dc:creator>LukeWebb</dc:creator>
      <dc:date>2015-05-26T14:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505425#M39753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still doesn't working the script. I mean doesn't add the shp to the TOC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14327541090572041" data-renderedposition="92_8_912_16" jivemacro_uid="_14327541090572041"&gt;&lt;P&gt;mxd.save()&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;I got this error message:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&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;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the weirdest part is if I manually drag and drop the result atlagint.shp to the TOC, after the second run automatically add the script the new atlagint.shp to the TOC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 19:22:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505425#M39753</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2015-05-27T19:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505426#M39754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you trying to save the mxd via web service or an external python editor or similar?,&amp;nbsp;&amp;nbsp; whilst you also have the mxd open in desktop GIS?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 20:30:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505426#M39754</guid>
      <dc:creator>LukeWebb</dc:creator>
      <dc:date>2015-05-27T20:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505427#M39755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did the python script by an external python editor (notead++), and yes i have the mxd open in desktop GIS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 21:15:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505427#M39755</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2015-05-27T21:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505428#M39756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason I asked is because that error is usually caused by having the same MXD&amp;nbsp; file being read at the same time by 2x processes, for example if you were running the script using one ArcMAP window, and you had the same mxd open in a different ArcMAP window, or computer. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try closing everything except one ArcMAP window and running the script, does the error still occur? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From your reply I guess you are using ArcMAP to run the script, not notepad ++.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 12:24:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505428#M39756</guid>
      <dc:creator>LukeWebb</dc:creator>
      <dc:date>2015-05-28T12:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505429#M39757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If i delete the&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14328189400671217 jive_macro_code jive_text_macro" data-renderedposition="29_8_912_16" jivemacro_uid="_14328189400671217"&gt;&lt;P&gt;mxd.save()&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;part, the script runs without error message, but doens't add the final shp to the map. I closed everything except the ArcMAP window. If I left the mxd.save() in the script i have the above mentioned error message, btw the script creates the atlagint.shp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the weirdest part:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the first run the script doens't add the atlagint.shp to the TOC.&lt;/P&gt;&lt;P&gt;If I add it manually (drag and drop) after the 2nd run the script add automatically the new atlagint.shp to the map...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 13:16:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505429#M39757</guid>
      <dc:creator>LaszloCsunderlik</dc:creator>
      <dc:date>2015-05-28T13:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.MapDocument(“CURRENT”)</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505430#M39758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the weird part is because when you add a shapefile to the map, it doesnt add a shapefile to the map, it adds a "link to a shapefile" to the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you have added the link to the shapefile into the map already, when you run the script, it overwrites the shapefile so it updates inside the map. The script itself hasn't changed anything to do with this, except update the shapefile itself, which is already in the map as you added it manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without the line mxd.save(), any changes that you make to the mxd will not be saved, however the shapefiles in the map which the script has managed to edit, will be updated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you say you closed everything except one Arc window, is that the window you then ran the script in? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try opening the Python window (Geoprocessing Menu --&amp;gt; Python)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then type: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; mxd.save()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this crash also?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 13:26:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-mapdocument-current/m-p/505430#M39758</guid>
      <dc:creator>LukeWebb</dc:creator>
      <dc:date>2015-05-28T13:26:22Z</dc:date>
    </item>
  </channel>
</rss>

