Setting environment variables

Donald 'Paddy' McCarthy paddy3118 at netscape.netNOTthisBIT
Thu Sep 18 17:30:39 EDT 2003


Sami Viitanen wrote:
> Hello,
> 
> Is there any other way to set variables than os.putenv().
> 
> Putenv doesn't actually put any values to actual system variables..
> 
> I'm trying to set CVSEDITOR variable automatically from script
> so that user wouldn't have to set that him/herself. CVS can't use variable
> set with putenv().

You could do the equivalent of:
  Paddy at maximillian ~ : echo $SHELL
/bin/bash
  Paddy at maximillian ~ : unset foo
  Paddy at maximillian ~ : eval `python -c 'print "foo=Hello;export foo"'`
  Paddy at maximillian ~ : echo $foo
Hello
  Paddy at maximillian ~ :

I use the following for setting up quite complex environments at work:
	http://modules.sourceforge.net/

Pad.





More information about the Python-list mailing list