Environment variables in Windows 2000

Brian Geddes brian.j.geddes at intel.com
Tue Nov 20 06:10:48 CET 2001

All -

I've been trying to store/pass information in environment variables in
Windows 2000, but things aren't working the way I expect them to.  The docs
state that by making changes to the os.system dictionary, the changes should
be carried over in environment space automatically by os.putenv().  However,
the following which looks like it should work, does not:

import os
import sys
os.system["HELLO"] = "Testing"

# Run Python again
import os
print os.system["HELLO"]

The second os.system call generates a KeyError.  I've also tried using the
os.putenv() and os.getenv() functions directly, but these don't seem to work
either.  I've tried on both 1.5.1 and 2.1.1 with the same results both ways.

Has anyone had any experience with this?

- Brian Geddes

More information about the Python-list mailing list