title: Python read windows Command Line output
body: <p>I am trying to execute a command in python and read its output on command line in windows. </p>
  
  <p>I have written the following code so far:</p>
  
  <pre><code>def build():
      command = "cobuild archive"
      print "Executing build"
      pipe = Popen(command,stdout=PIPE,stderr=PIPE)
      while True:     
          line = pipe.stdout.readline()
          if line:
              print line
  </code></pre>
  
  <p>I want to execute the command cobuild archive in command line and read it's output. However, the above code is giving me this error. </p>
  
  <pre><code> File "E:\scripts\utils\build.py", line 33, in build
     pipe = Popen(command,stdout=PIPE,stderr=PIPE)
   File "C:\Python27\lib\subprocess.py", line 679, in __init__
     errread, errwrite)
   File "C:\Python27\lib\subprocess.py", line 893, in _execute_child
     startupinfo)
  WindowsError: [Error 2] The system cannot find the file specified
  </code></pre>