Something strange with python 2.2.1 under RedHat 8.0

Nagy László Zsolt nagylzs at freemail.hu
Thu Jun 26 19:05:19 CEST 2003


>
>
>I can't iterate over os.environ, while a 'hand-made' dictionary works.  It
>works fine with python 2.2.3 under FreeBSD 4.8. I looked through the
>release notes but didn't find anything I thought applied, so I guess I'd
>just like to know if this is something peculiar to my system, or is it
>more wide-spread? 
>
I think it is more wide-spread. :-(

D:\Python\Projects>python
Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import os
 >>> os.environ
{'TMP': 'D:\\DOCUME~1\\Laci\\LOCALS~1\\Temp', 'USERNAME': 'Laci', 
'COMPUTERNAME'
: 'EARTH', 'LOGONSERVER': '\\\\EARTH', 'PROMPT': '$P$G', 'COMSPEC': 
'D:\\WINDOWS
\\system32\\cmd.exe', 'USERDOMAIN': 'EARTH', 'PYTHONPATH': 
'D:\\Python\\Lib;D:\\
Projects\\GeochemSource\\WebSpiders\\Lib', 'COMMONPROGRAMFILES': 
'D:\\Program Fi
les\\Common Files', 'PROCESSOR_IDENTIFIER': 'x86 Family 6 Model 8 
Stepping 1, Au
thenticAMD', 'PROGRAMFILES': 'D:\\Program Files', 'PROCESSOR_REVISION': 
'0801',
'SYSTEMROOT': 'D:\\WINDOWS', 'PATHEXT': 
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;
.WSF;.WSH', 'CLIENTNAME': 'Console', 'PATH': 
'D:\\WINDOWS\\system32;D:\\WINDOWS;
D:\\WINDOWS\\System32\\Wbem;D:\\PROGRA~1\\Borland\\Delphi6\\Bin;D:\\Lib\\Bpl;D:\
\Python22', 'WINDIR': 'D:\\WINDOWS', 'TEMP': 
'D:\\DOCUME~1\\Laci\\LOCALS~1\\Temp
', 'HOMEDRIVE': 'D:', 'ALLUSERSPROFILE': 'D:\\Documents and 
Settings\\All Users'
, 'SYSTEMDRIVE': 'D:', 'PROCESSOR_ARCHITECTURE': 'x86', 
'NUMBER_OF_PROCESSORS':
'1', 'APPDATA': 'D:\\Documents and Settings\\Laci\\Application Data', 
'PROCESSOR
_LEVEL': '6', 'SESSIONNAME': 'Console', 'HOMEPATH': '\\Documents and 
Settings\\L
aci', 'OS': 'Windows_NT', 'USERPROFILE': 'D:\\Documents and Settings\\Laci'}
 >>> for i in os.environ:
... print i
...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "D:\Python22\Lib\os.py", line 387, in __getitem__
return self.data[key.upper()]
AttributeError: 'int' object has no attribute 'upper'
 >>> d = {1:'',2:'sadf',3:2134}
 >>> for i in d:
... print i
...
1
2
3
 >>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030626/9f61e000/attachment.html>


More information about the Python-list mailing list