title: Piping popen stderr and stdout
body: <p>I want to call scripts from a directory (they are executable shell scripts) via python.</p>
  
  <p>so far so good: </p>
  
  <pre><code>    for script in sorted(os.listdir(initdir), reverse=reverse):
          if script.endswith('.*~') or script == 'README':
               continue
          if os.access(script, os.X_OK):
              try:
                  execute = os.path.abspath(script)
                  sp.Popen((execute, 'stop' if reverse else 'start'),
                           stdin=None, stderr=sp.PIPE,
                           stdout=sp.stderr, shell=True).communicate()
              except:
                  raise
  </code></pre>
  
  <p>Now what i Want is: lets say i have a bash script with a start functiont. from which I call </p>
  
  <blockquote>
    <p>echo "Something"</p>
  </blockquote>
  
  <p>Now I want to see that echo on sys.stdout and the exit Code. I believe you do this with .communicate() but mine doesn't work the way i thought it would.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Any help is much appreciated</p>