<?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: Issue on Adding Feature to Open MXD in Real Time Using ArcPy in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816050#M317</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan but now I am getting another error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;I followed all of these steps&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;As:&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;1- Start up the &lt;CODE&gt;Streets.mxd&lt;/CODE&gt; in ArcMap&lt;BR /&gt;2- Run the &lt;CODE&gt;mxd=arcpy.mapping.MapDocument("CURRENT")&lt;/CODE&gt; inside the ArcMap (without no error)&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="https://i.stack.imgur.com/cIDwb.png" rel="nofollow noreferrer noopener" style="color: #358daa; border: 0px; font-weight: inherit; text-decoration: none; font-size: inherit;" target="_blank"&gt;&lt;IMG alt="enter image description here" src="https://i.stack.imgur.com/cIDwb.png" style="border: 0px; font-weight: inherit; font-size: inherit;" /&gt;&lt;/A&gt;&lt;BR /&gt;3- Add the same &lt;CODE&gt;mxd=arcpy.mapping.MapDocument("CURRENT")&lt;/CODE&gt; to my code in &lt;CODE&gt;PyScripter&lt;/CODE&gt; IDE as&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="comment token"&gt;####mxd = arcpy.mapping.MapDocument(r"C:\Temp\Street.mxd")&lt;/SPAN&gt;
mxd&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
df &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListDataFrames&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Layers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
targetGroupLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Main"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; df&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
addLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Layer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Data\NetMap.gdb\Streets\OneWay"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddLayerToGroup&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;df&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; targetGroupLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; addLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"BOTTOM"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;RefreshActiveView&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;RefreshTOC&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;but I am getting this runtime error message:&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="https://i.stack.imgur.com/oduly.png" rel="nofollow noreferrer noopener" style="color: #358daa; border: 0px; font-weight: inherit; text-decoration: none; font-size: inherit;" target="_blank"&gt;&lt;IMG alt="enter image description here" src="https://i.stack.imgur.com/oduly.png" style="border: 0px; font-weight: inherit; font-size: inherit;" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote" style="color: #242729; background-color: #eeeeee; border-style: initial initial initial solid; border-color: initial initial initial transparent; margin: 0px 0px 10px; padding: 10px;"&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;Traceback (most recent call last): File "C:\Users\bhosseini\Documents\ArcPy\Trace With Graphics\module3.py", line 3, in mxd=arcpy.mapping.MapDocument("CURRENT") File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\arcobjects\mixins.py", line 625, in &lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;init&lt;/STRONG&gt;super(MapDocumentMethods, self).&lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;init&lt;/STRONG&gt;(mxd) File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\arcobjects_base.py", line 47, in &lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;init&lt;/STRONG&gt; for arg in args)) &lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;RuntimeError: Object: CreateObject cannot open map document&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:38:31 GMT</pubDate>
    <dc:creator>BehrouzHosseini</dc:creator>
    <dc:date>2021-12-12T09:38:31Z</dc:date>
    <item>
      <title>Issue on Adding Feature to Open MXD in Real Time Using ArcPy</title>
      <link>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816048#M315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using this code to add a feature from GeoDatabase dataset to an open MXD file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
mxd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Temp\Streets.mxd"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
df &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListDataFrames&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Layers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
targetGroupLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Main"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; df&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
addLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Layer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Data\NetMap.gdb\Streets\OneWay"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddLayerToGroup&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;df&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; targetGroupLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; addLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"BOTTOM"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is somehow adding the `OneWay` feature class to the `Main` Group Layer at `Streets.mxd` but I have to close the map and reopen it to see the data there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to refresh the TOC and Active view like (As it work in IDE inside the Current Map)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;RefreshActiveView&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;RefreshTOC&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it is not doing anything with&amp;nbsp;stand-alone script and MXD. Can you please let me know if there is a way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:38:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816048#M315</guid>
      <dc:creator>BehrouzHosseini</dc:creator>
      <dc:date>2021-12-12T09:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Issue on Adding Feature to Open MXD in Real Time Using ArcPy</title>
      <link>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816049#M316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if it is open did you try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV data-object-id="195322" data-object-type="1"&gt;&lt;DIV data-jive-view="apps/content/questions/correct_view"&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE&gt;arcpy&lt;SPAN&gt;.&lt;/SPAN&gt;mapping&lt;SPAN&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN&gt;(&lt;/SPAN&gt;"current"&lt;SPAN&gt;) # or capital c... can't remember offhand&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2017 22:44:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816049#M316</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-05-18T22:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Issue on Adding Feature to Open MXD in Real Time Using ArcPy</title>
      <link>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816050#M317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan but now I am getting another error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;I followed all of these steps&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;As:&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;1- Start up the &lt;CODE&gt;Streets.mxd&lt;/CODE&gt; in ArcMap&lt;BR /&gt;2- Run the &lt;CODE&gt;mxd=arcpy.mapping.MapDocument("CURRENT")&lt;/CODE&gt; inside the ArcMap (without no error)&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="https://i.stack.imgur.com/cIDwb.png" rel="nofollow noreferrer noopener" style="color: #358daa; border: 0px; font-weight: inherit; text-decoration: none; font-size: inherit;" target="_blank"&gt;&lt;IMG alt="enter image description here" src="https://i.stack.imgur.com/cIDwb.png" style="border: 0px; font-weight: inherit; font-size: inherit;" /&gt;&lt;/A&gt;&lt;BR /&gt;3- Add the same &lt;CODE&gt;mxd=arcpy.mapping.MapDocument("CURRENT")&lt;/CODE&gt; to my code in &lt;CODE&gt;PyScripter&lt;/CODE&gt; IDE as&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="comment token"&gt;####mxd = arcpy.mapping.MapDocument(r"C:\Temp\Street.mxd")&lt;/SPAN&gt;
mxd&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
df &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListDataFrames&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Layers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
targetGroupLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Main"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; df&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
addLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Layer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Data\NetMap.gdb\Streets\OneWay"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddLayerToGroup&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;df&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; targetGroupLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; addLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"BOTTOM"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;RefreshActiveView&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;RefreshTOC&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;but I am getting this runtime error message:&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="https://i.stack.imgur.com/oduly.png" rel="nofollow noreferrer noopener" style="color: #358daa; border: 0px; font-weight: inherit; text-decoration: none; font-size: inherit;" target="_blank"&gt;&lt;IMG alt="enter image description here" src="https://i.stack.imgur.com/oduly.png" style="border: 0px; font-weight: inherit; font-size: inherit;" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote" style="color: #242729; background-color: #eeeeee; border-style: initial initial initial solid; border-color: initial initial initial transparent; margin: 0px 0px 10px; padding: 10px;"&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;Traceback (most recent call last): File "C:\Users\bhosseini\Documents\ArcPy\Trace With Graphics\module3.py", line 3, in mxd=arcpy.mapping.MapDocument("CURRENT") File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\arcobjects\mixins.py", line 625, in &lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;init&lt;/STRONG&gt;super(MapDocumentMethods, self).&lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;init&lt;/STRONG&gt;(mxd) File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\arcobjects_base.py", line 47, in &lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;init&lt;/STRONG&gt; for arg in args)) &lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;RuntimeError: Object: CreateObject cannot open map document&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:38:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816050#M317</guid>
      <dc:creator>BehrouzHosseini</dc:creator>
      <dc:date>2021-12-12T09:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Issue on Adding Feature to Open MXD in Real Time Using ArcPy</title>
      <link>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816051#M318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/guidelinesforarcpymapping.htm"&gt;http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/guidelinesforarcpymapping.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;has to be run from within arcmap (I suspect its python window) not catalog and background geoprocessing disabled... see the section&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;H2&gt;Reference a map document on disk or use the CURRENT keyword within ArcMap&lt;/H2&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2017 17:47:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816051#M318</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-05-19T17:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issue on Adding Feature to Open MXD in Real Time Using ArcPy</title>
      <link>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816052#M319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan it was helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2017 21:42:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/issue-on-adding-feature-to-open-mxd-in-real-time/m-p/816052#M319</guid>
      <dc:creator>BehrouzHosseini</dc:creator>
      <dc:date>2017-05-19T21:42:47Z</dc:date>
    </item>
  </channel>
</rss>

