Antoine Pitrou <pit...@free.fr> added the comment:

Well apparently nt.environ doesn't reflect os.environ:

>>> os.environ['PYTHONCASEOK'] = '1'
>>> nt.environ['PYTHONCASEOK']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'PYTHONCASEOK'
>>> nt.environ[b'PYTHONCASEOK']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: b'PYTHONCASEOK'
>>> os.environ['PYTHONCASEOK']
'1'
>>> os.environ[b'PYTHONCASEOK']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\t\cpython\lib\os.py", line 450, in __getitem__
    value = self._data[self.encodekey(key)]
  File "C:\t\cpython\lib\os.py", line 508, in encodekey
    return encode(key).upper()
  File "C:\t\cpython\lib\os.py", line 503, in check_str
    raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not bytes

This is silly and is because of how the environ mapping is implemented in 
Lib/os.py: under POXIX, os.environ reflects posix.environ (it uses the same 
underlying dict), while under Windows, os.environ uses a distinct dict from 
nt.environ.

----------

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

Reply via email to