how to get the environment variable??
ed_tsang at yahoo.com
ed_tsang at yahoo.com
Thu May 10 18:53:18 EDT 2001
hi i am trying to set a global variable called tharn from the
environemtn variable in my .cshrc file ...
I used the folowing code:
try:
tharn = os.environ['THARN']
except KeyError:
try:
tharn = os.environ['CTF']
except KeyError:
print "\nEnvironment variable THARN must be set"
print "before starting the Test Harness."
sys.exit(1)
The problem I am facing is tharn can be set by either environment
varible CTF or THARN. Only one of CTF and THARN should exist, or
they can be both missing then user get a wanring message...
I amnot sure if my code is archieveing that....
or any potential pittfall in this ... wondering if I may intoduce
error in having another try .. except block in KeyError...
thanks
More information about the Python-list
mailing list