Something strange with python 2.2.1 under RedHat 8.0

Peter Hansen peter at
Thu Jun 26 19:27:51 CEST 2003

Richard Kuhns wrote:
> Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
> [GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> for k in os.environ:
> ...  print k
> ...
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.2/", line 14, in __getitem__
>     def __getitem__(self, key): return[key]
> KeyError: 0

Judging by the error message, os.environ is *not* a dict, but
a UserDict.   If it were to be subclassed from IterableUserDict
instead, it would work okay I guess.

Checking Python 2.2.2, I find it *is* now subclassed from 
IterableUserDict, so you're reporting a bug that is fixed
in a later release.  Please upgrade.

I'd check the bug tracker on SourceForge, but I am rarely able to use
that pathetic piece of crap successfully to search for already-reported
bugs, so I'll just skip it... :-)


More information about the Python-list mailing list