Embedding setenv

Fredrik Lundh fredrik at pythonware.com
Thu Feb 22 06:28:05 EST 2001


Clodagh O'Rourke wrote:
> I was wondering does anyone know how to embed the setenv command in python.
> I've tried os.system("setenv  VARIABLE value")
> But I get:  sh: setenv: not found

Even if the default shell had a setenv command (setenv is
a csh feature, not a unix command), that approach wouldn't
work.

try this instead:

    os.environ["VARIABLE"] = "value"

(for more info on why setting environment in one subprocess
won't affect environment variables in another subprocess, see
your nearest Unix FAQ).

Cheers /F





More information about the Python-list mailing list