anydbm - a simple question

Andrew M. Kuchling akuchlin at mems-exchange.org
Sat Jan 22 15:58:09 EST 2000


Randall Hopper <aa8vb at yahoo.com> writes:
>     File "/home/rhh/software/python-1.5.2/lib/python1.5/dumbdbm.py", line 87, \
>       in _addval
>       f.write('\0'*(npos-pos))
>   TypeError: can't multiply sequence with non-int

I'll bet you're on Solaris and are picking up the large file support,
which makes the .tell() method of file objects return a long integer.
But you can't multiply a sequence by a long integer, only a regular
integer:

>>> 2*'a'
'aa'
>>> 2L * 'a'
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: can't multiply sequence with non-int

Short-term, you can patch dumbdbm.py to use int(npos-pos), but this is
really an interpreter bug; there's no reason 2L * 'a' should be an
error.

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
All the evils of publishing can be traced to one source -- copyright.
    -- Stefan Stykolt, quoted by Kildare Dobbs in _The Living Name_ (1964)




More information about the Python-list mailing list