subprocess.Popen executes .sh differently then subprocess.call
<p>I'm trying to run parsey mcparseface from a subprocess. I get different results when running Popen vs call and I'm wondering why this is.
This works.</p>

<pre><code>process = subprocess.Popen("./syntaxnet/demo.sh", cwd="/home/kahless/models/syntaxnet")
</code></pre>

<p>This does not.</p>

<pre><code>process = subprocess.call("./syntaxnet/demo.sh", cwd="/home/kahless/models/syntaxnet")
</code></pre>

<p>Both execute without python throwing any errors but when running .call parsey does not complete correctly. This also happens when using .wait() or .communicate() with Popen. What I'm trying to do is pause the execution of my code until parsey finishes. Not sure whats going on here.</p>

<p>Edit. When I say that parsey does not complete correctly I mean I am getting a different end result from running the demo.sh file. Here are the different outputs.</p>

<p>When things work correctly</p>

<p>INFO:tensorflow:Processed 10 documents
INFO:tensorflow:Total processed documents: 10
INFO:tensorflow:num correct tokens: 0
INFO:tensorflow:total tokens: 170
INFO:tensorflow:Seconds elapsed in evaluation: 0.18, eval metric: 0.00%
INFO:tensorflow:Processed 10 documents
INFO:tensorflow:Total processed documents: 10
INFO:tensorflow:num correct tokens: 10
INFO:tensorflow:total tokens: 153
INFO:tensorflow:Seconds elapsed in evaluation: 0.86, eval metric: 6.54%</p>

<p>When they do not.</p>

<p>INFO:tensorflow:Total processed documents: 0
INFO:tensorflow:Total processed documents: 0</p>

<p>Are you sure it ever finishes?</p>

<p>Looks like your code hangs. Perhaps it takes user input?</p>

<p><code>subprocess.call()</code> waits until it finishes so as <code>wait()</code> and <code>communicate()</code></p>

python