os.putenv ?

sik0fewl xxdigitalhellxx at hotmail.com
Thu Mar 27 18:18:01 CET 2003


Jacek Generowicz wrote:
> "Chermside, Michael" <mchermside at ingdirect.com> writes:
> 
> 
>>> > cat > grrr.py
>>> import os
>>> os.putenv("GRRR","This is a late parrot.")
>>> print "GRRR has been set to:", os.getenv("GRRR")
>>> > echo $GRRR
>>> 
>>> > python grrr.py 
>>> GRRR has been set to: None
>>> > echo $GRRR
>>> 
>>> 
>>> What am I missing ?
> 
> 
> [...]
> 
> 
>>What are you trying to achieve?  Perhaps there's a better way.
> 
> 
> Set up the environment for a user who is about to be running lots of
> Python scripts ... without having to write a shell script for each
> flavour of UNIX shell under the sun ... so trying it in Python seemed
> the natural way.

I don't think that's necessary. Write a bourne shell script, I'm pretty 
sure every* system comes with it.

#!/bin/sh
...


* every UNIX or UNIX clone system

-- 
Ryan





More information about the Python-list mailing list