[Python-bugs-list] [Bug #128037] problems using the shelve module

noreply@sourceforge.net noreply@sourceforge.net
Mon, 08 Jan 2001 06:49:47 -0800


Bug #128037, was updated on 2001-Jan-08 06:35
Here is a current snapshot of the bug.

Project: Python
Category: Python Library
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 5
Submitted by: rosleff
Assigned to : nobody
Summary: problems using the shelve module

Details: I'm running Python 1.5.2 (#4, Jan 12 2000, 22:14:11)  [GCC 2.95
19990728 (release)] on irix646. 

While using the shelve module the following error message occurs:

>>> import shelve
>>> class someClass:
...   def __init__(self):
...     self = [13, 17]
... 
>>> object = someClass()
>>> dbase = shelve.open('testshelve')
>>> dbase['key'] = object
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python1.5/shelve.py", line 71, in __setitem__
    self.dict[key] = f.getvalue()
  File "/usr/local/lib/python1.5/dumbdbm.py", line 111, in __setitem__
    (pos, siz) = self._addval(val)
  File "/usr/local/lib/python1.5/dumbdbm.py", line 87, in _addval
    f.write('\0'*(npos-pos))
TypeError: can't multiply sequence with non-int


Follow-Ups:

Date: 2001-Jan-08 06:49
By: gvanrossum

Comment:
This is fixed in 2.0.  If you want to fix it yourself in 1.5.2, change 	the
line "pos = f.tell()" to "	pos = int(f.tell())" in method _addval() in
dumdbm.py.

-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=128037&group_id=5470