<?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 Open shp with python in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112173#M1342</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all, I am trying &amp;nbsp;to create a python´s script to take a shapefile and open it on ArcMap .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code :&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import os,string,arcpy&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;os.system('ArcMap.exe C:\Users\Administrator.DBGS.000\Desktop\shap.mxd')&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.MakeFeatureLayer_management("C:\Users\Administrator.DBGS.000\Desktop\shape\cities.shp") &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.RefreshActiveView()&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.RefreshTOC()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;--------------------------------------------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But this code only opens arcmap with shap.mxd and nothing more , however if &amp;nbsp;I open arcmap and copy the three last lines of my script in arcmap´s python window , it works and open the shape and show the layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why it is working in&amp;nbsp;arcmap´s python window but not with an external python script??&lt;/P&gt;&lt;P&gt;Any idea to open a shapefile automatically with code ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance¡&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Luis.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Apr 2017 09:41:37 GMT</pubDate>
    <dc:creator>luis_enriquemartin_cañamero</dc:creator>
    <dc:date>2017-04-06T09:41:37Z</dc:date>
    <item>
      <title>Open shp with python</title>
      <link>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112173#M1342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all, I am trying &amp;nbsp;to create a python´s script to take a shapefile and open it on ArcMap .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code :&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import os,string,arcpy&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;os.system('ArcMap.exe C:\Users\Administrator.DBGS.000\Desktop\shap.mxd')&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.MakeFeatureLayer_management("C:\Users\Administrator.DBGS.000\Desktop\shape\cities.shp") &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.RefreshActiveView()&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.RefreshTOC()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;--------------------------------------------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But this code only opens arcmap with shap.mxd and nothing more , however if &amp;nbsp;I open arcmap and copy the three last lines of my script in arcmap´s python window , it works and open the shape and show the layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why it is working in&amp;nbsp;arcmap´s python window but not with an external python script??&lt;/P&gt;&lt;P&gt;Any idea to open a shapefile automatically with code ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance¡&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Luis.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2017 09:41:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112173#M1342</guid>
      <dc:creator>luis_enriquemartin_cañamero</dc:creator>
      <dc:date>2017-04-06T09:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Open shp with python</title>
      <link>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112174#M1343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;because the ability to add the results of a geoprocessing operation to the display (see Geoprocessing options) is either turned off or is not supported by python IDEs external to ArcMap.&amp;nbsp; Check your options to see if the add results is turned off&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2017 11:08:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112174#M1343</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-04-06T11:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Open shp with python</title>
      <link>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112175#M1344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will probably have to add the "layer" (shapefile) to the map: See&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/addlayer.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/addlayer.htm"&gt;AddLayer—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;scroll down for code samples.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2017 12:53:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112175#M1344</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2017-04-06T12:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Open shp with python</title>
      <link>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112176#M1345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't control an ArcMap session from a stand-alone Python script.&amp;nbsp; Your first command launches ArcMap, but your second command has absolutely no idea about that ArcMap session or any other ArcMap session that is running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to open an MXD with a certain layer added to it, you need to use ArcPy Mapping to edit the MXD first and then launch ArcMap after saving the changes to the MXD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2017 13:12:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/open-shp-with-python/m-p/112176#M1345</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-04-06T13:12:38Z</dc:date>
    </item>
  </channel>
</rss>

