Re: Set an environment variable
Christian wrote:[color=blue]
> Steve Holden wrote:
>
>[color=green]
>>::::::::::::: :
>>one.py
>>::::::::::::: :
>>import os
>>os.environ['STEVE'] = "You are the man"
>>os.system("py thon two.py")
>>print "Ran one"
>>::::::::::::: :
>>two.py
>>::::::::::::: :
>>import os
>>print "STEVE is", os.environ['STEVE']
>>print "Ran two"
>>[sholden@headrat tmp]$ python one.py
>>STEVE is You are the man
>>Ran two
>>Ran one
>>[sholden@headrat tmp]$
>>
>>Hope this helps.
>>
>>regards
>> Steve[/color]
>
>
> 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.s h")[/color]
Time you answered your own questions by trying things at the interactive
interpreter prompt!
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
Christian wrote:[color=blue]
> Steve Holden wrote:
>
>[color=green]
>>::::::::::::: :
>>one.py
>>::::::::::::: :
>>import os
>>os.environ['STEVE'] = "You are the man"
>>os.system("py thon two.py")
>>print "Ran one"
>>::::::::::::: :
>>two.py
>>::::::::::::: :
>>import os
>>print "STEVE is", os.environ['STEVE']
>>print "Ran two"
>>[sholden@headrat tmp]$ python one.py
>>STEVE is You are the man
>>Ran two
>>Ran one
>>[sholden@headrat tmp]$
>>
>>Hope this helps.
>>
>>regards
>> Steve[/color]
>
>
> 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.s h")[/color]
Time you answered your own questions by trying things at the interactive
interpreter prompt!
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
Comment