title: How to determine subprocess.Popen() failed when shell=True
body: <p>Windows version of Python 2.6.4: Is there any way to determine if subprocess.Popen() fails when using shell=True?</p>
  
  <p>Popen() successfully fails when shell=False</p>
  
  <pre><code>&gt;&gt;&gt; import subprocess
  &gt;&gt;&gt; p = subprocess.Popen( 'Nonsense.application', shell=False )
  Traceback (most recent call last):
    File "&gt;&gt;&gt; pyshell#258", line 1, in &lt;module&gt;
      p = subprocess.Popen( 'Nonsense.application' )
    File "C:\Python26\lib\subprocess.py", line 621, in __init__
      errread, errwrite)
    File "C:\Python26\lib\subprocess.py", line 830, in
  _execute_child
      startupinfo)
  WindowsError: [Error 2] The system cannot find the file specified
  </code></pre>
  
  <p>But when shell=True, there appears to be no way to determine if a Popen() call was successful or not.</p>
  
  <pre><code>&gt;&gt;&gt; p = subprocess.Popen( 'Nonsense.application', shell=True )
  &gt;&gt;&gt; p
  &gt;&gt;&gt; subprocess.Popen object at 0x0275FF90&gt;&gt;&gt;
  &gt;&gt;&gt; p.pid
  6620
  &gt;&gt;&gt; p.returncode
  &gt;&gt;&gt;
  </code></pre>
  
  <p>Ideas appreciated.</p>
  
  <p>Regards,
  Malcolm</p>