Environment variables.
Vamsi K Kalapala
vamsi at cs.unm.edu
Fri Mar 22 17:26:54 EST 2002
>
Hi,
I am learning python and I wanted to write a small script that will set
environment variables.
#!/usr/bin/python
# Program to set the environment.
# Import the sys and os modules.
import sys
import os
# Function to change the environment.
def setenv(var, value):
os.environ[var] = value
# The driver.
if __name__ == '__main__' :
setenv(sys.argv[1], sys.argv[2])
I am running this on Python-2.2, but the script doesn't change the
environment. In Programming Python, it is claimed that newer versions of
Python do change the environment like this. Why is'nt this script
working.
--Vamsi
More information about the Python-list
mailing list