Modifying the environment

Erno Kuusela erno at iki.fi
Thu May 25 19:47:31 EDT 2000


>>>>> "Daley," == Daley, MarkX <markx.daley at intel.com> writes:

    Daley,> Hello, everyone!  Here is a subject someone has to have
    Daley,> covered at one time.  How do I modify the environment
    Daley,> using Python in such a way that the changes stay after the
    Daley,> Python script executes?  I'm sure there's a way, I just
    Daley,> haven't uncovered it yet.  If I use os.environ or
    Daley,> os.putenv(), the changes only last as long as I remain in
    Daley,> Python.  Even the DOS window protects it's own copy of the
    Daley,> environment!

it's the way environment variables work. there's nothing
much you can do about it. the processes you start will
inherit your environment though.

if you really really wanted to, you could probably attach
to your parent process like a debugger attach to another
process, and prod its memory space. but i'll leave
that as an exercise for the reader :).

  -- erno



More information about the Python-list mailing list