title: PHP show return from python script
body: <p>I am unable to get php to show full results of my python script, only the last basic print statement is printed. What am I doing wrong here? Why is the php not showing the output from the python script?</p>
  
  <p>php </p>
  
  <pre><code>$result = exec('python list.py');
  echo $result;
  </code></pre>
  
  <p>list.py</p>
  
  <pre><code>import subprocess
  
  print "start"
  
  a = subprocess.Popen(["ls", "-a"], stdout=subprocess.PIPE)
  a.wait()
  result_str = a.stdout.read()
  print result_str
  
  print "stop"
  </code></pre>
  
  <p>the command line output for that python script is as below</p>
  
  <pre><code>start
  ...filename
  ...filename
  ...etc...etc
  
  stop
  </code></pre>
  
  <p>The php output from executing the python script is only </p>
  
  <blockquote>
    <p>stop</p>
  </blockquote>
  
  <p>Thank you</p>