Environment Variable

tuxlover at gmail.com tuxlover at gmail.com
Mon Jul 11 17:15:21 EDT 2005


Is it possible to set an environment variable from inside the python
script which will be retained after the script exits.

If I use the following code:

import os
os.putvar("name", "tuxlover")

the enivironment variable name is visible to only the sub-process
created by os.system and os.popen. But as soon as the python script
vanishes, the environment variable "name" is gone.

What I am wondering is that is it possible to set a environment
variable from inside a python script, and then access it (say, echo
$name from the shell) after the python script exits.

Thanks
Tuxlover




More information about the Python-list mailing list