Embedding setenv

O'Rourke Clodagh-corour01 corour01 at motorola.com
Thu Feb 22 09:11:01 EST 2001

>>I've tried os.system("setenv  VARIABLE value")
>>But I get:  sh: setenv: not found

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

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

I'm trying to set environment variables in a GSM network environment I tried 

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

And I got.....

SyntaxError: can't assign to function call 

I'm working on putting a front end on the Network-Controller Environment variables reading data to/from Informix and setting the environment.

If I can't do this directly from the python back end of the application, I might have to write the variables/values to another script and keep the setenv stuff separate....


More information about the Python-list mailing list