Python bugs
Skip Montanaro
skip at mojam.com
Mon Nov 29 15:59:01 EST 1999
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import os
>>> {}.update(os.environ)
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: dictionary, instance
>>> import shelve
>>> s = shelve.open('foo')
>>> s.get('bar', 'baz')
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: get
>>>
I believe os.environ is a class to allow constructs like
os.environ["FOO"] = "PYTHON"
to work like
os.putenv("FOO", "PYTHON")
with regard to setting or changing the values of environment variables.
The lack of a get attribute in shelve objects seems to have been rectified
since the 1.5.2 release:
>>> db = shelve.BsdDbShelf (bsddb.btopen("/var/tmp/foo2", "c"))
>>> db["1"] = 1
>>> db.keys()
['1']
>>> db.get("1", 0)
1
>>> db.get("2", 0)
0
Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
847-971-7098 | Python: Programming the way Guido indented...
More information about the Python-list
mailing list