I set an environment variable that I want to access in my Python application. How do I get its value?
The original question (first part) was "how to check environment variables in Python."
Here's how to check if $FOO is set:
try: os.environ["FOO"] except KeyError: print "Please set the environment variable FOO" sys.exit(1)