<?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 Problems with converting script to run in IDE from Py window in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/problems-with-converting-script-to-run-in-ide-from/m-p/549531#M24072</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a python script to download satellite fire detection hotspots and do some various things to&amp;nbsp;them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today, I wanted to run it within Visual Studio to use the debugger. I referenced an arcPy book&amp;nbsp;for steps required to change the script to remove errors when running from an IDE verus the ArcGIS Pro Python window .&lt;/P&gt;&lt;P&gt;The only requirement that I found mentioned appears to be changing the argument from "CURRENT" to the full path of the .aprx file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed the line:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&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;‍
aprxMap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&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;‍‍&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;into&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\gmarcus\Documents\ArcGIS\Projects\MyProject8_del6\MyProject8_del6.aprx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍
aprxMap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&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;‍‍‍‍&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;I experienced no errors when executing the script from within the Python window in ArcGIS Pro. When running from Visual Studio or PyCharm,&amp;nbsp;the .aprx file acts as if the script is operating on a different file. (It isn't.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To investigate this further:&lt;/P&gt;&lt;P&gt;I set several breakpoints to investigate the state of different variables. Using the Immediate Window&amp;nbsp;, I was able to addDataFromPath, and get it to list the layer names that the script adds, but the layers &lt;EM&gt;don't appear&lt;/EM&gt; in the ArcGIS Pro map window.&amp;nbsp; Applying symbology from a layer file fails as if the target layer wasn't added.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I &lt;EM&gt;was&lt;/EM&gt; able to add data manually from manual arcPy commands issue from the Immediate Window. I saved the .aprx file as a different file, opened it and verified that the data layers were added. Yet, I still couldn't apply symbologyFromLayer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate the recent mention from Leslie on 1/7 and I re-wrote this to make my issues more clear. Having this post be seen over 80 times with zero responses is frustrating. I'm &lt;EM&gt;not&lt;/EM&gt; looking for help on the &lt;EM&gt;script itself&lt;/EM&gt; (I'm not a sadist), but I am hoping someone can post pre-existing documentation, if it exists.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Are there any documented steps that describe what must be changed in a script to transition from running in the ArcGIS Pro Python window to running from an IDE?&lt;/STRONG&gt; I must be missing something else, but I couldn't find the answer. I'm including my script.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 23:46:42 GMT</pubDate>
    <dc:creator>GabrielMarcus1</dc:creator>
    <dc:date>2021-12-11T23:46:42Z</dc:date>
    <item>
      <title>Problems with converting script to run in IDE from Py window</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problems-with-converting-script-to-run-in-ide-from/m-p/549531#M24072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a python script to download satellite fire detection hotspots and do some various things to&amp;nbsp;them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today, I wanted to run it within Visual Studio to use the debugger. I referenced an arcPy book&amp;nbsp;for steps required to change the script to remove errors when running from an IDE verus the ArcGIS Pro Python window .&lt;/P&gt;&lt;P&gt;The only requirement that I found mentioned appears to be changing the argument from "CURRENT" to the full path of the .aprx file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed the line:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&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;‍
aprxMap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&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;‍‍&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;into&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\gmarcus\Documents\ArcGIS\Projects\MyProject8_del6\MyProject8_del6.aprx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍
aprxMap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&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;‍‍‍‍&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;I experienced no errors when executing the script from within the Python window in ArcGIS Pro. When running from Visual Studio or PyCharm,&amp;nbsp;the .aprx file acts as if the script is operating on a different file. (It isn't.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To investigate this further:&lt;/P&gt;&lt;P&gt;I set several breakpoints to investigate the state of different variables. Using the Immediate Window&amp;nbsp;, I was able to addDataFromPath, and get it to list the layer names that the script adds, but the layers &lt;EM&gt;don't appear&lt;/EM&gt; in the ArcGIS Pro map window.&amp;nbsp; Applying symbology from a layer file fails as if the target layer wasn't added.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I &lt;EM&gt;was&lt;/EM&gt; able to add data manually from manual arcPy commands issue from the Immediate Window. I saved the .aprx file as a different file, opened it and verified that the data layers were added. Yet, I still couldn't apply symbologyFromLayer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate the recent mention from Leslie on 1/7 and I re-wrote this to make my issues more clear. Having this post be seen over 80 times with zero responses is frustrating. I'm &lt;EM&gt;not&lt;/EM&gt; looking for help on the &lt;EM&gt;script itself&lt;/EM&gt; (I'm not a sadist), but I am hoping someone can post pre-existing documentation, if it exists.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Are there any documented steps that describe what must be changed in a script to transition from running in the ArcGIS Pro Python window to running from an IDE?&lt;/STRONG&gt; I must be missing something else, but I couldn't find the answer. I'm including my script.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:46:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problems-with-converting-script-to-run-in-ide-from/m-p/549531#M24072</guid>
      <dc:creator>GabrielMarcus1</dc:creator>
      <dc:date>2021-12-11T23:46:42Z</dc:date>
    </item>
  </channel>
</rss>

