<?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 toolbox spawns an C++ executable code with its associated GDAL DLL in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1109684#M62726</link>
    <description>&lt;P&gt;Thank you for the suggestion. I tried it and still getting the same error message.&amp;nbsp; To be sure that the path to the DLL is passing to the process, I created python script that print the PATH environment and called it the same way and the call confirms that the first directory in the PATH is the path to the DLL.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Oct 2021 13:40:25 GMT</pubDate>
    <dc:creator>Rakefet</dc:creator>
    <dc:date>2021-10-21T13:40:25Z</dc:date>
    <item>
      <title>Python toolbox spawns an C++ executable code with its associated GDAL DLL</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1108833#M62686</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to run a third part C++ application&amp;nbsp; from a python toolbox. The third party application comes as an executable file with its&amp;nbsp; GDAL DLL. To run this application from the toolbox,&amp;nbsp; I tried os.system(cmd_str) or&amp;nbsp;subprocess.call(cmd_str, shell=False) and got the error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rakefet_0-1634654768884.png" style="width: 744px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/25525iF5925A9C4C3A47F5/image-dimensions/744x175?v=v2" width="744" height="175" role="button" title="Rakefet_0-1634654768884.png" alt="Rakefet_0-1634654768884.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I thought that the problem is&amp;nbsp; incompatible versions of GDAL but when&amp;nbsp;I ran os.system(cmd_str) from&amp;nbsp; a Python window outside of ArcGIS pro (same environment as ArcGIS Pro) , it works.&amp;nbsp; I am getting the same error when I run&amp;nbsp;os.system(cmd_str) from ArcGIS Python window.&amp;nbsp; &amp;nbsp;I would appreciate any ideas how to solve this problem.&amp;nbsp; Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 14:55:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1108833#M62686</guid>
      <dc:creator>Rakefet</dc:creator>
      <dc:date>2021-10-19T14:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python toolbox spawns an C++ executable code with its associated GDAL DLL</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1108868#M62690</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/501219"&gt;@Rakefet&lt;/a&gt;&amp;nbsp;Does this blog post help you?&lt;BR /&gt;&lt;A href="https://arcpy.wordpress.com/2015/08/17/arcpy-interoperability-with-c-library/" target="_blank"&gt;https://arcpy.wordpress.com/2015/08/17/arcpy-interoperability-with-c-library/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 15:41:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1108868#M62690</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2021-10-19T15:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Python toolbox spawns an C++ executable code with its associated GDAL DLL</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1108871#M62691</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/501219"&gt;@Rakefet&lt;/a&gt;&amp;nbsp;Can you review this .py file to see if your implementation is similar?&lt;BR /&gt;&lt;A href="https://github.com/arcpy/arcpy-cpp-interop/blob/master/gptool_script.py" target="_blank"&gt;https://github.com/arcpy/arcpy-cpp-interop/blob/master/gptool_script.py&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 15:53:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1108871#M62691</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2021-10-19T15:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Python toolbox spawns an C++ executable code with its associated GDAL DLL</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1108918#M62692</link>
      <description>&lt;P&gt;Thank you for your response. I am not sure gptool_script.py can help me because the third party exe is using functions from the DLL but it is not part of the DLL. To understand better the issue that I have,&amp;nbsp; I invoked gdalinfo.exe (which has associated DLL).&amp;nbsp; I used in my tool the command&amp;nbsp;subprocess.call("&amp;lt;path to gdalinfo that &lt;STRONG&gt;is not&lt;/STRONG&gt; part of ArcGIS path&amp;gt;gdalinfo &amp;lt;my image&amp;gt;") and it works. So, it is something else that causes the problem but I am clueless...&lt;/P&gt;&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;</description>
      <pubDate>Tue, 19 Oct 2021 17:03:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1108918#M62692</guid>
      <dc:creator>Rakefet</dc:creator>
      <dc:date>2021-10-19T17:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Python toolbox spawns an C++ executable code with its associated GDAL DLL</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1109335#M62715</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/501219"&gt;@Rakefet&lt;/a&gt;&amp;nbsp;via the virtual water cooler talk, this response seemed useful:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;P&gt;Normally, I would expect DLL resolution to work fine for a DLL co-located in the same directory as an executable. One approach the user might take is to try and modify the PATH environment variable prior to executing the subprocess call, this can be done for example with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from subprocess import Popen&lt;/P&gt;&lt;P&gt;from os import environ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my_env = environ.copy()&lt;/P&gt;&lt;P&gt;my_env["PATH"] = "C:/location/of/DLL;" + my_env["PATH"]&lt;/P&gt;&lt;P&gt;Popen(my_command, env=my_env, shell=True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that is sufficient. A more involved approach is using Process Monitor to see the DLL loads (and failures) as they occur.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 20 Oct 2021 16:39:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1109335#M62715</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2021-10-20T16:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Python toolbox spawns an C++ executable code with its associated GDAL DLL</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1109684#M62726</link>
      <description>&lt;P&gt;Thank you for the suggestion. I tried it and still getting the same error message.&amp;nbsp; To be sure that the path to the DLL is passing to the process, I created python script that print the PATH environment and called it the same way and the call confirms that the first directory in the PATH is the path to the DLL.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 13:40:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1109684#M62726</guid>
      <dc:creator>Rakefet</dc:creator>
      <dc:date>2021-10-21T13:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Python toolbox spawns an C++ executable code with its associated GDAL DLL</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1109714#M62728</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I was able to run my exe file from the Python toolbox by renaming the folder of the GDAL plugin. This way it is not in the searching path. I would prefer to remove this folder from my environment&amp;nbsp; but I could not find it (it is not in my environment). This is not a preferable&amp;nbsp; way to work around but it works.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 14:28:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-spawns-an-c-executable-code-with/m-p/1109714#M62728</guid>
      <dc:creator>Rakefet</dc:creator>
      <dc:date>2021-10-21T14:28:50Z</dc:date>
    </item>
  </channel>
</rss>

