Environment variables

jeff jeff at parlant.com
Thu Dec 2 16:05:36 EST 1999


Thanks, that's what I was afraid of.  Looks like I am stuck writing a
batch/shell script.


"Gerrit Holl" <gerrit.holl at pobox.com> wrote in message
news:19991202205512.A8481 at stopcontact.palga.uucp...
> jeff wrote:
> > How do I set environment variables outside the python script?
>
> os.environ["PATH"] = "/bin:/usr/bin:/usr/local/bin"
>
> > 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).
>
> Not possible. The Python script is started as a child. You can't set
> environment variables for a parent.
>
> > I need this for both Linux and NT/Win2k.
>
> I don't know how it works on NT, but on Linux, you could output this,
> like dircolors does:
>
> export VARNAME=VARCONTENT;
> export ANOTHERVARNAME=ANOTHERVARCONTENT
>
> you could make a shell script:
> #!/bin/sh
>
> eval $(script.py $*)
>
>
> Have fun!
>
>
> --
> "Open Standards, Open Documents, and Open Source"
>
>   -- Scott Bradner (Open Sources, 1999 O'Reilly and Associates)
>   8:52pm  up  7:25, 14 users,  load average: 1.35, 1.19, 1.06
>
>






More information about the Python-list mailing list