title: Using python with subprocess Popen
body: <p>I am struggling to use subprocesses with python.  Here is my task:</p>
  
  <ol>
  <li>Start an api via the command line (this should be no different than running any argument on the command line)  </li>
  <li>Verify my API has come up.  The easiest way to do this would be to poll the standard out.  </li>
  <li>Run a command against the API.  A command prompt appears when I am able to run a new command  </li>
  <li>Verify the command completes via polling the standard out (the API does not support logging)  </li>
  </ol>
  
  <p>What I've attempted thus far:<br>
  1. I am stuck here using the Popen.  I understand that if I use
  <code>subprocess.call("put command here")</code> this works.  I wanted to try to use something similar to:</p>
  
  <pre><code>import subprocess
  
  def run_command(command):
    p = subprocess.Popen(command, shell=True,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.STDOUT)
  </code></pre>
  
  <p>where I use <code>run_command("insert command here")</code> but this does nothing.</p>
  
  <p>with respect to 2. I think the answer should be similar to here:
  <a href="https://stackoverflow.com/questions/4760215/running-shell-command-from-python-and-capturing-the-output">Running shell command from Python and capturing the output</a>,
  but as I can't get 1. to work, I haven't tried that yet.</p>