How to set environment variables in Python -
i need set environment variables in python script , want other scripts called python (shell scripts) child process see environment variables set. value number.
if os.environ["debussy"] = 1
, complains saying 1
has string. want know how read environment variables in python (in later part of script) once set it.
environment variables must strings, use
os.environ["debussy"] = "1"
to set variable debussy
string 1
. access variable later, use
print os.environ["debussy"]
child processes automatically inherit environment of parent process -- no special action on part required.
Comments
Post a Comment