<?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 + GME (Spatial Ecology) + Subprocess.call in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459021#M35999</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've run into the same issue. Typically, with the scripts I wrote that integrate GME and Arc via Python, Arc and GME don't always play nice and I have a feeling the Arc software runs something that GME has a tough time handling. However, when I have had that pop-up appear, when I click ok, typically my scripts run, albeit on the 2nd or 3rd try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did get a reply from the GME creator, and that was his best guess, that a temp toolbox is set up and GME gets a little confused. I also know the GME creator is switching everything to R so that he won't have to rely on the Arc libraries taht would cause this. Already GME doesn't work with 10.2, or least I had an issue with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I created the scripts and use them in ArcToolbox, but they definitely run best when run directly via a Python IDE (I use PythonWin), and then are ok through ArcCatalog, and all the inputs have to be out of the map document if I run them in ArcMap. However, they do seem to work, though it varies from tool to tool, depending on if it solely uses and algorithm in GME, or if it needs the Arc libraries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So not much insight, but hope this helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alison&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Sep 2013 20:29:09 GMT</pubDate>
    <dc:creator>AlisonMontgomery</dc:creator>
    <dc:date>2013-09-13T20:29:09Z</dc:date>
    <item>
      <title>Python + GME (Spatial Ecology) + Subprocess.call</title>
      <link>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459015#M35993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am attempting to run GME functions using python using "subprocess.call".&amp;nbsp; But every time I receive a Windows error message (see attached image). Apparently the log file cannot be found (incorrect path). I was wondering if this is because of the double forward slash (see red circle in attached image). Is this really the cause of the error? If yes, then how can this be fixed?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will post the code I am using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import subprocess as subp
subp.call(r'C:\Program Files\SpatialEcology\GME\SEGME.exe -c run(in=\"H:\GME\testing\text_commands\exportcsv.txt\");')&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The text file contains the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;export.csv(in="H:\GME\testing\data\test4csv.shp", out="H:\GME\testing\text_commands\output\exportcsv.csv");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2013 07:04:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459015#M35993</guid>
      <dc:creator>SvenJunghans</dc:creator>
      <dc:date>2013-09-04T07:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Python + GME (Spatial Ecology) + Subprocess.call</title>
      <link>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459016#M35994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Sven, I've run into the exact same problem. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to wrap up the GME commands in Python and have actually had some good success. Now that I understand the proper way to pass the correct syntax, i was able to execute from the Python shell. Now i'm attempting to roll my script in a model in ArcGIS and this is where I'm hitting the same error. Let me look at your error message more closely, and I'll also report back any other findings or observations that come along.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes I have the // as well, but I'm not sure why that's getting pushed to GME.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sven, curious, are you executing this in a python shell, or as a script added to arctoolbox? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My original test scripts executed just fine in the the python shell, but when executed from ArcMap, that's when the error occurs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Trying to sort out as many variables as we can.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 16:32:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459016#M35994</guid>
      <dc:creator>ZacharyHart</dc:creator>
      <dc:date>2013-09-12T16:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python + GME (Spatial Ecology) + Subprocess.call</title>
      <link>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459017#M35995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yesterday I spent some more time on attempting to resolve this problem. I noticed the error only occurs when executing the python script from within ArcMap (or ArcCatalog). When using the shell there is no error and it seems to work fine (as you mentioned already).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The path leads to an .htm log file (name seems to contain date and time). This file contains general information about GME and says whether the execution of the GME function was successful or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;path: "C:\Users\sjunghans\AppData\Local\Temp\arc35A\SpatialEcology\20130903_153332\Log_20130903_153332.htm"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems to be possible to modify the GME config file ("C:\Program Files\SpatialEcology\GME\SEGME.exe.config") to change the way GME creates or interacts with the log file. But when looking at the code it's not obvious to me what to modify.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When the error pops up and I close it, then the GME function executes as it should.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Reinstalling python, GME or R didn't fix the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My ultimate goal is to create a tool (python script or model builder) which executes a sequence of functions from both GME and ArcGIS (without the need to close an error window...).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 07:28:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459017#M35995</guid>
      <dc:creator>SvenJunghans</dc:creator>
      <dc:date>2013-09-13T07:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python + GME (Spatial Ecology) + Subprocess.call</title>
      <link>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459018#M35996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sven, similar experience all the way around. I tried to modify the config file, but if you look at what it says:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;!-- Uncomment the below section to write to the Application Event Log --&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!--&amp;lt;add name="EventLog"/&amp;gt;--&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So Un-commenting it &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;enables&lt;/SPAN&gt;&lt;SPAN&gt; some kind of logging (I haven't seen anything in any available documentation about this). I think this is all related to VB debugging anyway. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an email out to Hawthorne (with the offer to pay for service), but haven't heard anything back. My concern is that this is a bug related to how GME decides to write a temp location when run within ArcMap. Note that every ArcMap session writes a 'arcABC1' type temp folder. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GME does not write any entries to your registry, so there's nothing to modify in there. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also have a post on the GIS Stack Exchange regarding this. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Too bad, I have a fair amount of time in just getting the correct syntax to pass from Python to GME and was getting excited about the sampling tools. I had gone down the path of trying to leverage the fishnet tool for my workflow, but sadly, it does not support rotation (its true). The GME option here would be perfect.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 11:15:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459018#M35996</guid>
      <dc:creator>ZacharyHart</dc:creator>
      <dc:date>2013-09-13T11:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Python + GME (Spatial Ecology) + Subprocess.call</title>
      <link>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459019#M35997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Zachary,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your input. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When having the arguments of the subprocess call in a list:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;subprocess.call([r'F:\Program Files\SpatialEcology\GME\SEGME.exe -c run(in=\"F:\GME Test\text command\download_image.txt\");']);&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I receive a Runtime Error message instead of the error window. It looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Runtime error 
Traceback (most recent call last):
&amp;nbsp; File "&amp;lt;string&amp;gt;", line 3, in &amp;lt;module&amp;gt;
&amp;nbsp; File "C:\Python27\Lib\subprocess.py", line 493, in call
&amp;nbsp;&amp;nbsp;&amp;nbsp; return Popen(*popenargs, **kwargs).wait()
&amp;nbsp; File "C:\Python27\Lib\subprocess.py", line 679, in __init__
&amp;nbsp;&amp;nbsp;&amp;nbsp; errread, errwrite)
&amp;nbsp; File "C:\Python27\Lib\subprocess.py", line 893, in _execute_child
&amp;nbsp;&amp;nbsp;&amp;nbsp; startupinfo)
WindowsError: [Error 2] The system cannot find the file specified&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Now perhaps this additional information can help with the debugging?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: Or is this some other error which is unrelated? (maybe wrong syntax for list?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please tell me if you get any feedback from Hawthorne (or stackexchange). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:26:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459019#M35997</guid>
      <dc:creator>SvenJunghans</dc:creator>
      <dc:date>2021-12-11T20:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Python + GME (Spatial Ecology) + Subprocess.call</title>
      <link>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459020#M35998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm going to go with a syntax error on that....I'll keep you posted for sure. Let me know if you have any success, or observations of any kind. I'm not sure this is an R problem, but i've thought about rolling back to an earlier version to test. Not many options at this point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I forgot to mention:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is but one observation I forgot to share. When the GUI is launched, and you get the error, clear/ 'OK' through that, and then you see that your command has not been submitted to the 'output' tab in GME. If I then use the &lt;/SPAN&gt;&lt;A href="http://www.spatialecology.com/gme/save.htm"&gt;'save' command&lt;/A&gt;&lt;SPAN&gt; manually, my process executes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 12:25:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459020#M35998</guid>
      <dc:creator>ZacharyHart</dc:creator>
      <dc:date>2013-09-13T12:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python + GME (Spatial Ecology) + Subprocess.call</title>
      <link>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459021#M35999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've run into the same issue. Typically, with the scripts I wrote that integrate GME and Arc via Python, Arc and GME don't always play nice and I have a feeling the Arc software runs something that GME has a tough time handling. However, when I have had that pop-up appear, when I click ok, typically my scripts run, albeit on the 2nd or 3rd try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did get a reply from the GME creator, and that was his best guess, that a temp toolbox is set up and GME gets a little confused. I also know the GME creator is switching everything to R so that he won't have to rely on the Arc libraries taht would cause this. Already GME doesn't work with 10.2, or least I had an issue with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I created the scripts and use them in ArcToolbox, but they definitely run best when run directly via a Python IDE (I use PythonWin), and then are ok through ArcCatalog, and all the inputs have to be out of the map document if I run them in ArcMap. However, they do seem to work, though it varies from tool to tool, depending on if it solely uses and algorithm in GME, or if it needs the Arc libraries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So not much insight, but hope this helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alison&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 20:29:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gme-spatial-ecology-subprocess-call/m-p/459021#M35999</guid>
      <dc:creator>AlisonMontgomery</dc:creator>
      <dc:date>2013-09-13T20:29:09Z</dc:date>
    </item>
  </channel>
</rss>

