This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients brett.cannon, pitrou
Date 2012-01-27.21:42:47
SpamBayes Score 3.132071e-07
Marked as misclassified No
Message-id <1327700568.22.0.963154831136.issue13890@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-01-27 21:42:48pitrousetrecipients: + pitrou, brett.cannon
2012-01-27 21:42:48pitrousetmessageid: <1327700568.22.0.963154831136.issue13890@psf.upfronthosting.co.za>
2012-01-27 21:42:47pitroulinkissue13890 messages
2012-01-27 21:42:47pitroucreate