Environment variables.

Cameron Laird claird at starbase.neosoft.com
Fri Mar 22 21:12:36 EST 2002


In article <3C9BAFAE.51D0896D at cs.unm.edu>,
Vamsi K Kalapala  <vamsi at cs.unm.edu> wrote:
>>
>
>Hi,
>
>I am learning python and I wanted to write a small script that will set
>environment variables.
>
>#!/usr/bin/python
>
># Program to set the environment.
>
># Import the sys and os modules.
>import sys
>import os
>
># Function to change the environment.
>def setenv(var, value):
>   os.environ[var] = value
>
># The driver.
>if __name__ == '__main__' :
>   setenv(sys.argv[1], sys.argv[2])
>
>I am running this on Python-2.2, but the script doesn't change the
>environment. In Programming Python, it is claimed that newer versions of
>Python do change the environment like this. Why is'nt this script
>working.
>
>--Vamsi
>

"... [Y]ou can't change the value of an environment variable
in another process".  That's what an authoritative FAQ <URL:
http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC8 > claims
on the matter.  That's almost entirely true.

What environment is it you want to change?  The one of the
parent of your Python process?  Why?

On what page of *Programming Python* do you find the claim to
which you refer?
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list