os.putenv ?

Erik Max Francis max at alcyone.com
Thu Mar 27 00:43:56 CET 2003

Peter Hansen wrote:

> Processes generally can't affect the environment
> of their parent process in this manner.  The environment
> is a property of the shell, and you have to use the shell
> to change it.  I believe one widely used technique for doing
> this is to run the Python script from within a shell script
> which will subsequently call out to another shell script
> named, say, "modifyEnv.sh".  Then the Python script can
> just write the desired changes out to the modifyEnv.sh and
> those changes will take effect when the Python script
> terminates and the other script is run...

Or you can have your Python script generate shell commands, and then
source the output.

 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ My long is strong enough, you know / Strong enough to let you go
\__/ Xscape
    Rules for Buh / http://www.alcyone.com/max/projects/cards/buh.html
 The official rules to the betting card game, Buh.

More information about the Python-list mailing list