473,396 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Something strange with python 2.2.1 under RedHat 8.0

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? Here's what I get:

: molin$~; python
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/UserDict.py", line 14, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 0 d = {}
d['one'] = 1
d['two'] = 2
d['three'] = 3
for k in d: .... print k
....
three
two
one


--
Richard Kuhns rj*****@geetel.net

Jul 18 '05 #1
1 1716
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/UserDict.py", line 14, in __getitem__
def __getitem__(self, key): return self.data[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... :-)

-Peter
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Romans Krjukovs | last post by:
Hi ! Our company is going to start use Python widely. To make this reality we have to include Python in our strategy plans for at least 3 nearest years. This would be a green light to our...
2
by: Russell E. Owen | last post by:
I'm trying to build Python 2.3.4 from source on a RedHat Enterprise machine for installation in a net-wide accessible directory /net/python. I tried all of the following variants of ./configure...
1
by: Vbfoo Bar | last post by:
Hello, To implement a Zope intranet on a linux RedHat ES 3, I had to install a Python 2.3.4 that I have compiled myself. I would like to compare the respective performance of this python...
3
by: bruce | last post by:
hi... i'm running rh8.0 with gnome.. i'm not sure of the version (it's whatever rh shipped). i've recently updated (or tried to update) python to the latest version. when i try to run the...
2
by: penglish1 | last post by:
This question applies specifically to RHEL 3.0 (actually Whitebox), but also generally to Redhat and probably pretty much every distribution that uses python for distribution-related tasks...
1
by: Bill Oldroyd | last post by:
I cannot get a simple CGI-script to work with this combination : Redhat 9 Linux Both Python 2.41. and ActiveState Python 2.4.1 either as an Apache 2 cgi-script or using CGIHTTPServer. The...
3
by: gmax2006 | last post by:
Hi, My RedHat Linux installation already has Python 2.3 on it. What is the easiest way to upgrade it to 2.4? I use ActiveState python in Windows. Is it the best distribution for Linux as...
8
by: yinglcs | last post by:
Hi, i am using red hat enterprise 4. It has python 2.3 installed. What is the best way to upgrade to python 2.4? I think one way is to compile python 2.4 from the source, but I can't remove...
2
by: karthikbalaguru | last post by:
Hi, I am new to python, Kindly suggest to resolve a problem with a python file. What does the below error refer to ? I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and db4-4.0.14-20....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.