title: Python subprocess cannot find programs
body: <p>I am trying to call a java application from a python script. When Java was installed, a <code>java.exe</code> program was added to the <code>c:\windows\system32</code> folder, this folder is included in the <code>PATH</code> environment variable.</p>
  
  <p>Running</p>
  
  <pre><code>import subprocess
  import os
  subprocess.call("java") //or "c:/windows/system32/java.exe"
  </code></pre>
  
  <p>results in</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "c:\Program Files (x86)\Quantum GIS Lisboa\apps\Python27\Lib\subprocess.py", line 493, in call
      return Popen(*popenargs, **kwargs).wait()
    File "c:\Program Files (x86)\Quantum GIS Lisboa\apps\Python27\Lib\subprocess.py", line 679, in __init__
      errread, errwrite)
    File "c:\Program Files (x86)\Quantum GIS Lisboa\apps\Python27\Lib\subprocess.py", line 893, in _execute_child
      startupinfo)
  WindowsError: [Error 2] Het systeem kan het opgegeven bestand niet vinden
  </code></pre>
  
  <p>Investigating a bit further, I tried running a console (<code>cmd</code>) using the same way. When doing a <code>dir c:\windows\system32</code> in that console, <code>java.exe</code> is not listed! In fact, a whole bunch of files are not listed compared to running the same command from a "normal" console.</p>
  
  <p>I have no clue what might be causing this, since the exact same workflow does work on another computer. I know I can circumvent the problem by directly calling the java installation, instead of the executable in the system32 folder, but I'd like to find the root of this problem.</p>
  
  <p>This problem is occurring in a Quantum Gis plugin. Quantum Gis uses an included python installation, so I did not install python myself. The python version listed is "2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on Win32". I am running Windows 7 Professional.</p>