Environment inheritance under Windows NT 4, Attempt 2

Milton L. Hankins mlh at swl.msd.ray.com
Fri Jun 25 21:08:53 CEST 1999

The mystery has been solved.  It turns out that my environment has a
duplicate name problem -- that is, two entries for the environment
variable exist in the data structure, each with two different values. This
can be easily be verified by writing a C program to print the contents of
_environ.  (I have such a program if anyone is interested.) 

This is not entirely the fault of Windows NT.  On my system, the
environment is being tainted by another appliacation.  However, NT is
permitting this to take place.  Feh.

Thus, an environment variable lookup becomes dependent on the
implementation's ordering.  In Python's implementation, the last entry
wins because it slurps the data from (C) _environ and stores it in
posix.environ.  The command prompt and getenv() seem to always get the
"right" value, somehow.

              Milton L. Hankins              \\  ><> Ezekiel 18:21 ><>
      http://www.snurgle.org/~mhankins       //  <mlh at swl.msd.ray.com>
    These are my opinions, not Raytheon's.   \\      W. W. J. D. ?

More information about the Python-list mailing list