PATH environment variable

mirandacascade at yahoo.com mirandacascade at yahoo.com
Sun Nov 20 19:09:06 CET 2005


I observed something tangential to this topic, and that is the reason
for this reply.  I don't understand when os.environ gets updated.  The
'...captured the first time the os mdule is imported...' verbiage from
the following link:

http://www.python.org/dev/doc/newstyle/lib/os-procinfo.html

provides some information, but it's not clear how to make that fit with
the following observations:

Sequence of steps...observation 1:
1) open Pythonwin interactive window
2) import os
3) os.environ['PATH'] - this presents the contents of the PATH variable
4) using Windows system properties/environment variables, change
contents of PATH variable; apply the changes (after closing, I got back
in to verify that the PATH variable was, in fact, changed)
5) in interactive window, reload(os)
6) os.environ['PATH'] - presents same value is in #3

Sequence of steps...observation 2:
1) open Pythonwin interactive window
2) import os
3) os.environ['PATH'] - this presents the contents of the PATH variable
4) using Windows system properties/environment variables, change
contents of PATH variable; apply the changes (after closing, I got back
in to verify that the PATH variable was, in fact, changed)
5) in interactive window, del os
6) in interactive window, import os
7) os.environ['PATH'] - presents the same value as in #3

I also observed that if I exit the interactive window, and then go back
into the interactive window, the os.environ['PATH'] reflects changes to
the PATH environment variable that happened while in the interactive
window the first time.

Do these observations fit with what is stated in section 6.1.1 of the
Python Library Reference?




More information about the Python-list mailing list