title: When would os.environ['foo'] not match os.getenv('foo')?
body: <p>I have a small Python application, launched via <code>subprocess.Popen</code>, that takes some parameters in the form of environment variables.  I do this by passing the environment structure into the <code>Popen</code> call.  The program then reads the variables via <code>os.getenv</code>.</p>
  
  <p>Or rather, it used to read them that way.  On Windows, it worked fine.  But on our FreeBSD servers, <code>os.getenv</code> returns <code>None</code> for all the parameters we passed in.  The odd part is that <code>os.environ</code> has the values just fine&mdash;and, indeed, simply switching all <code>os.getenv('foo')</code> calls to <code>os.environ['foo']</code> made everything work just fine on <em>both</em> platforms.</p>
  
  <p>Why are these values different?  When is one appropriate over the other?</p>