Embedding setenv

Chris Gonnerman chris.gonnerman at usa.net
Thu Feb 22 14:42:08 CET 2001


----- Original Message -----
From: "O'Rourke Clodagh-corour01" <corour01 at motorola.com>
Subject: Embedding setenv


> Hi all,
>
> 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
>
> Any ideas?
>
> Thanks,
> Clodagh O Rourke

In general, you can't do this.  setenv (in csh) is a builtin, and doesn't
exist in /bin/sh or /bin/bash
at all.  Are you trying to set variables in your parent processes'
environment?  Can't do that in
Unix, period.  If you are trying to set your own environment, including
controlling the environment
of future child processes, use os.environ, which is a mapping
(dictionary-like object):

    import os
    os.environ['VARIABLE'] = 'value'







More information about the Python-list mailing list