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