Environment variables
Donn Cave
donn at u.washington.edu
Thu Dec 2 17:41:04 EST 1999
Quoth "jeff" <jeff at parlant.com>:
| How do I set environment variables outside the python script?
|
| Basicaly, I want to run a python script to set some environment variables,
| then be able to use them in the shell that had called the python script
| (after the script had completed).
|
| I need this for both Linux and NT/Win2k.
I don't know about Windows, but you just can't do that on UNIX.
The parent process (the shell) has its own environment data in its
own process memory, where it's safe from your Python program.
The way to communicate with the shell is "print" the data, and
the shell can pick up the output and assign it to a variable -
SPV=`python spv.py`
export SPV
Donn Cave, University Computing Services, University of Washington
donn at u.washington.edu
More information about the Python-list
mailing list