<?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.mp.ArcGISProject(&amp;quot;current&amp;quot;) - not working in python toolbox? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520601#M71249</link>
    <description>&lt;P&gt;notebooks know the existence of 'current' are you running the toolbox from within Pro as well?&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 15:21:25 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2024-08-13T15:21:25Z</dc:date>
    <item>
      <title>arcpy.mp.ArcGISProject("current") - not working in python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520380#M71245</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this code with ArcGIS Pro 2.x without any problems from my .pyt-toolbox. Now (3.3.1) I always get "&lt;STRONG&gt;OSError: CURRENT&lt;/STRONG&gt;". It still works when I call it from a python notebook, which I have opened in my ArcGIS Pro project. But I need to get it to work again in this setup:&lt;/P&gt;&lt;P&gt;I'm creating a Dockpane using the ArcGIS Pro SDK. On that dockpane is a button, when clicked, this happens:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string installPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string toolboxPath = System.IO.Path.Combine(installPath, "Data.pyt\\Repair");
await Geoprocessing.ExecuteToolAsync(toolboxPath, null, null, null, null, GPExecuteToolFlags.None); &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this executes my tool and this works.&lt;/P&gt;&lt;P&gt;The Repair method is now reduced to :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;p = arcpy.mp.ArcGISProject('CURRENT')
m = p.listMaps()[0]
l = m.listLayers()[0]
pprint.pprint(l.connectionProperties)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this does work in my notebook but from my pyt-toolbox I get "OSError: CURRENT".&lt;/P&gt;&lt;P&gt;I already tried to run the Tool from within an ArcGIS Pro project, but it doesn't work either, when there is an active map. however, if there is no active map, I get "index out of range".&amp;nbsp;&lt;/P&gt;&lt;P&gt;any ideas would be appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 12:04:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520380#M71245</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-08-13T12:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject("current") - not working in python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520589#M71247</link>
      <description>&lt;P&gt;If the project is closed, then try using the full path to the aprx&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 15:10:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520589#M71247</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-08-13T15:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject("current") - not working in python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520593#M71248</link>
      <description>&lt;P&gt;the project is open, running properly. there is also an active map and active layers.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 15:12:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520593#M71248</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-08-13T15:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject("current") - not working in python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520601#M71249</link>
      <description>&lt;P&gt;notebooks know the existence of 'current' are you running the toolbox from within Pro as well?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 15:21:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520601#M71249</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-08-13T15:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject("current") - not working in python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520609#M71250</link>
      <description>&lt;P&gt;yes. i browsed through the catalog to the toolbox, right-click &amp;gt;&amp;gt; Edit. in the editor I clicked Run. that should be from within?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 15:32:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520609#M71250</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-08-13T15:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject("current") - not working in python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520635#M71251</link>
      <description>&lt;P&gt;I'm not as familiar with Python Toolboxes, as I am with regular Toolboxes, but by my understanding Right-Click&amp;gt;&amp;gt;Edit and then click Run would NOT be running it in the project.&lt;/P&gt;&lt;P&gt;That's going to run it in whichever IDE you have set up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try double-clicking it in the catalog, rather than Right-click&amp;gt;&amp;gt;Edit.&amp;nbsp; Does that work as expected?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 16:01:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1520635#M71251</guid>
      <dc:creator>MErikReedAugusta</dc:creator>
      <dc:date>2024-08-13T16:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject("current") - not working in python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1521131#M71252</link>
      <description>&lt;P&gt;thanks, yes now it's working. thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 06:15:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mp-arcgisproject-quot-current-quot-not/m-p/1521131#M71252</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-08-14T06:15:16Z</dc:date>
    </item>
  </channel>
</rss>

