Set an environment variable

Christian christian at spam.not
Fri Oct 21 07:29:18 EDT 2005


Steve Holden wrote:

> ::::::::::::::
> one.py
> ::::::::::::::
> import os
> os.environ['STEVE'] = "You are the man"
> os.system("python two.py")
> print "Ran one"
> ::::::::::::::
> two.py
> ::::::::::::::
> import os
> print "STEVE is", os.environ['STEVE']
> print "Ran two"
> [sholden at headrat tmp]$ python one.py
> STEVE is You are the man
> Ran two
> Ran one
> [sholden at headrat tmp]$
> 
> Hope this helps.
> 
> regards
>  Steve

Thanks Steve, you're quite right, you are the man. And thanks to all the 
rest of you for your kind help and patient understanding. I have learned 
quite a lot and is about to consider my self advanced to the status of 
Python newbie.

So here is my final question:
Do I call the .sh script with a .py script like this:

os.system("/path/to/the/script/startupscript.sh")



More information about the Python-list mailing list