Modifying environment variables

Terry Hancock hancock at anansispaceworks.com
Fri Dec 21 18:04:30 EST 2001


Hi,
I've been using Python for a lot of different
programming tasks, but haven't experimented with
it much as a scripting language.

In my current problem, I needed a smarter way
to parse user's "PATH" (Solaris/UNIX environment),
so I implemented a simple program which uses the
os module to break up the path, do some simple
tests on it and reassemble it.

However, all this work is wasted, because after
I leave the script, the PATH is unaffected. It
seems that assigning values to os.environ['PATH']
can affect subshells, but not the one I'm running
the script from.

Is there a way to get around this limitation? It
would be a lot nicer if I could just call the
script from the users' .cshrc file (I should've
mentioned that they are invariably using csh or
tcsh).

Thanks for any pointers.

Terry

(please CC).

-- 
------------------------------------------------------
Terry Hancock
hancock at anansispaceworks.com       
Anansi Spaceworks                 
http://www.anansispaceworks.com 
P.O. Box 60583                     
Pasadena, CA 91116-6583
------------------------------------------------------




More information about the Python-list mailing list