Modifying the environment

Dirck Blaskey dirck.IsGettingTooMuchSpam at pacbell.net
Thu May 25 22:32:22 EDT 2000


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

Assuming you are running Win32 of one form or another;

Under NT the environment variables are stored in the Registry
(in more than one place)
http://support.microsoft.com/support/kb/articles/Q104/0/11.asp

Under 95 there is a system utility 'winset', for setting environment
variables (I haven't tried this):
http://support.microsoft.com/support/kb/articles/Q140/5/74.asp

This stuff should be wrap-able for Python.





More information about the Python-list mailing list