<?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: Python collision with stand alone ArcGISPro application in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041951#M39093</link>
    <description>&lt;P&gt;You definitely mentioned threading, but your GH repo is named "arc-gispro-python-net-licensing-collision," so I thought you thought licensing was involved too.&amp;nbsp; I just read too much into your repo name.&lt;/P&gt;&lt;P&gt;If it is OK with you, I would like to move this discussion over to the ArcGIS Pro SDK space since people following that space might be a better audience.&amp;nbsp; That said, I think discussing with Esri Support is the next best step for you.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 14:20:16 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-03-30T14:20:16Z</dc:date>
    <item>
      <title>Python collision with stand alone ArcGISPro application</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041301#M39039</link>
      <description>&lt;P&gt;In the attached video I demonstrate a case where Python.NET code is running while ArcGIS.Core is initialized. Code fails on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;some&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;commands. This is probably due to the internal implementation of ArcGISPro.Core. It is either using Python.NET or uses a different Python to C++ marshaling.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/s/dkndivr6p4ygqai/esr-python-collision.mp4?dl=0" target="_blank" rel="noopener"&gt;https://www.dropbox.com/s/dkndivr6p4ygqai/esr-python-collision.mp4?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I run the application without initializing the host – it passes the Python call successfully (sec 16 )&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I initialize the Thread with Host.Initialize()&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I run the same code and it throws an exception&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The exception is of a generic undefined error.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;“External component has thrown an exception. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.”&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;It seems that Host.Initialize() &amp;nbsp;gets control over all the threads, while Python is attempting to do the same.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Python.Net allows users to run python code form .net environment. I use “pythonnet_netstandard_py37_win” Nuget package which is in full compatibility with ArcGIS pro 2.7 (and python 3.7 ).&lt;/P&gt;&lt;P&gt;The same code runs successfully end to end when Host.Initialize() is not running in the same application.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Failed Attempts:&lt;/P&gt;&lt;P&gt;·&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Creating a new thread in STA and MTA compartments prior&lt;/P&gt;&lt;P&gt;·&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Using Default and Current TaskSchedulers.&lt;/P&gt;&lt;P&gt;·&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Creating a dedicated TaskFactory&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;before&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;init&lt;/P&gt;&lt;P&gt;·&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Creating a dedicated TaskFactory&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;after&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;init&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The collision is happening on C++ authorization level. Thus has to be addressed by the ESRI team.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I have created a repository to replicate the issue both in running and not running state is provided here&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/gis-geodata/arc-gispro-python-net-licensing-collision" target="_blank" rel="noopener"&gt;gis-geodata/arc-gispro-python-net-licensing-collision (github.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;To replicate the exceptions &lt;A href="https://github.com/gis-geodata/arc-gispro-python-net-licensing-collision/blob/a4abfb72b7ded11c3c54474b8e608f183d1b1d2a/Collision.Runner/Program.cs#L29" target="_self"&gt;comment out this line&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Full StackTrace&lt;/P&gt;&lt;P&gt;System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at Python.Runtime.PyObject.Invoke(PyTuple args, PyDict kw)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at Python.Runtime.PyObject.InvokeMethod(String name, PyTuple args, PyDict kw)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at Python.Runtime.PyObject.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object&amp;amp; result)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at CallSite.Target(Closure , CallSite , Object , PyString )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at Cadaster.Gateway.EnvironmentConfiguration.PythonScripts.CreateCityUser(String cityName, Object arcpy, DataBase database) in I:\Cadaster\Gateway\EnvironmentConfiguration\PythonScripts.cs:line 108&lt;/P&gt;</description>
      <pubDate>Sat, 27 Mar 2021 15:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041301#M39039</guid>
      <dc:creator>dkuida</dc:creator>
      <dc:date>2021-03-27T15:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Python collision with stand alone ArcGISPro application</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041375#M39046</link>
      <description>&lt;P&gt;Since you believe this relates to licensing, how are you licensing your ArcGIS Pro install?&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 15:52:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041375#M39046</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-03-28T15:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Python collision with stand alone ArcGISPro application</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041837#M39081</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not say I believe it is a licensing issue, I believe it is a threading issue.&lt;/P&gt;&lt;P&gt;But to answer the question - it is a floating license from a local license server.&lt;/P&gt;&lt;P&gt;The same approach persists with a named user ( EDN).&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 05:45:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041837#M39081</guid>
      <dc:creator>dkuida</dc:creator>
      <dc:date>2021-03-30T05:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python collision with stand alone ArcGISPro application</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041951#M39093</link>
      <description>&lt;P&gt;You definitely mentioned threading, but your GH repo is named "arc-gispro-python-net-licensing-collision," so I thought you thought licensing was involved too.&amp;nbsp; I just read too much into your repo name.&lt;/P&gt;&lt;P&gt;If it is OK with you, I would like to move this discussion over to the ArcGIS Pro SDK space since people following that space might be a better audience.&amp;nbsp; That said, I think discussing with Esri Support is the next best step for you.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 14:20:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1041951#M39093</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-03-30T14:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Python collision with stand alone ArcGISPro application</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1042741#M39180</link>
      <description>&lt;P&gt;Move it of course&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;I oversaw the SDK while looking for topics.&lt;/P&gt;&lt;P&gt;The local distributor of ESRI is the one in fact that told me to publish it here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; As it would get a better chance to reach the dev team.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 04:36:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-collision-with-stand-alone-arcgispro/m-p/1042741#M39180</guid>
      <dc:creator>dkuida</dc:creator>
      <dc:date>2021-04-01T04:36:52Z</dc:date>
    </item>
  </channel>
</rss>

