<?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 Python variables not working in pro sdk in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/python-variables-not-working-in-pro-sdk/m-p/857793#M4573</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using the&amp;nbsp; CallScriptFromNet pro sdk community sample&amp;nbsp;to run&amp;nbsp;a python script in Pro via an addin. If i add the script through pro in a toolbox it runs fine but&amp;nbsp;if i build an addin that runs it from the CallScriptFromNet example it errors on the "CURRENT" value of &lt;SPAN style="font-family: Consolas; font-size: small;"&gt;arcpy.mp.ArcGISProject. Is there something in the way it's being run from an addin that makes the python script run differently? Has anyone found a solution for this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CallScriptFromNet example: &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geoprocessing/CallScriptFromNet"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geoprocessing/CallScriptFromNet&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Updated .py Script:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; sys&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; arcpy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; arcpy &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; env&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; arcpy.mp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; os&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;aprx = arcpy.mp.ArcGISProject(&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;aprxFolder = aprx.homeFolder&lt;/P&gt;&lt;P&gt;mname = aprx.activeMap.name&lt;/P&gt;&lt;P&gt;m = aprx.listMaps(mname)[0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True))&lt;/P&gt;&lt;P&gt;OSError: CURRENT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Jan 2019 23:12:14 GMT</pubDate>
    <dc:creator>NicholasFerri</dc:creator>
    <dc:date>2019-01-03T23:12:14Z</dc:date>
    <item>
      <title>Python variables not working in pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/python-variables-not-working-in-pro-sdk/m-p/857793#M4573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using the&amp;nbsp; CallScriptFromNet pro sdk community sample&amp;nbsp;to run&amp;nbsp;a python script in Pro via an addin. If i add the script through pro in a toolbox it runs fine but&amp;nbsp;if i build an addin that runs it from the CallScriptFromNet example it errors on the "CURRENT" value of &lt;SPAN style="font-family: Consolas; font-size: small;"&gt;arcpy.mp.ArcGISProject. Is there something in the way it's being run from an addin that makes the python script run differently? Has anyone found a solution for this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CallScriptFromNet example: &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geoprocessing/CallScriptFromNet"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geoprocessing/CallScriptFromNet&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Updated .py Script:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; sys&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; arcpy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; arcpy &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; env&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; arcpy.mp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; os&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;aprx = arcpy.mp.ArcGISProject(&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;aprxFolder = aprx.homeFolder&lt;/P&gt;&lt;P&gt;mname = aprx.activeMap.name&lt;/P&gt;&lt;P&gt;m = aprx.listMaps(mname)[0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True))&lt;/P&gt;&lt;P&gt;OSError: CURRENT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2019 23:12:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/python-variables-not-working-in-pro-sdk/m-p/857793#M4573</guid>
      <dc:creator>NicholasFerri</dc:creator>
      <dc:date>2019-01-03T23:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python variables not working in pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/python-variables-not-working-in-pro-sdk/m-p/857794#M4574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are not running this script inside the Python window&amp;nbsp;in ArcGIS Pro, "CURRENT" will have no meaning. You will have to specify the path to the ArcGIS Pro project for it to work outside the Python window in ArcGIS Pro.&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; sys
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; env
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
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;
aprxFolder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;homeFolder
mname &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;activeMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name
m &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;mname&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;

m
&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Map object at &lt;SPAN class="number token"&gt;0x000001DCB2994080&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;

mname
&lt;SPAN class="string token"&gt;'Map'&lt;/SPAN&gt;

aprxFolder
&lt;SPAN class="string token"&gt;'C:\\Users\\xande\\OneDrive\\Documenten\\ArcGIS\\Projects\\PercentileRaster'&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;/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;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:36:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/python-variables-not-working-in-pro-sdk/m-p/857794#M4574</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T10:36:45Z</dc:date>
    </item>
  </channel>
</rss>

