Václav Šmilauer added the comment:

I checked on Windows 7 64bit with python 2.7 (sorry, not python 3.3 installed 
here) with the script attached. Each line sets a variable using the method in 
the very left column, then it attempts to read it back using all methods.

              os.environ       win32   os.?etenv      msvcrt      msvcr?
  os.environ          OK          OK          OK          --          --
       win32          --          OK          --          --          --
   os.?etenv          --          OK          --          --          --
      msvcrt          --          OK          --          OK          --
      msvcr?          --          OK          --          --          --

Methods which can read back what they also set are os.environ, win32api, 
msvcrt. OTOH, msvcr? (which is ctypes.util.find_msvcr(), in my case 
msvcr90.dll) does not read its own values, just like os.getenv/os.putenv.

It *seems* that reading with win32 API is very reliable (that is not a good 
news for writing cross-platform extension modules), though, but perhaps it just 
asks the CRT if it does not find the variable defined (my testing did not go 
that far).

@Andrew: you're probably right, though it does not explain, why msvcr90.dll 
does not read back the values I set in there - that is the CRT python27.dll 
itself links to --

----------
Added file: http://bugs.python.org/file28243/tryenv2.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16633>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to