Environment variables in Windows 2000
Prabhu Ramachandran
prabhu at aero.iitm.ernet.in
Tue Nov 20 03:36:58 EST 2001
>>>>> "BG" == Brian Geddes <brian.j.geddes at intel.com> writes:
BG> be carried over in environment space automatically by
BG> os.putenv(). However, the following which looks like it
BG> should work, does not:
BG> import os import sys os.system["HELLO"] = "Testing" sys.exit()
Umm that should be:
>>> import os
>>> os.environ['HELLO'] = "testing"
>>> os.popen('echo $HELLO').readlines()
['testing\n']
But this will only affect subprocesses as the documentation says:
"""
putenv (varname, value)
Set the environment variable named varname to the string value.
Such changes to the environment affect subprocesses started
with os.system(), popen() or fork() and execv(). Availability:
most flavors of Unix, Windows. ..."""
prabhu
More information about the Python-list
mailing list