shelve.open() and error 22: invalid argument

max.aginaga at gmail.com max.aginaga at gmail.com
Thu Nov 1 16:08:18 EDT 2007


Hi everyone

I've come across the following problem: on two different linux
machines, both running python 2.5 (r25:51908), I have the same file
'd.dat'. The md5 checksums are the same.

Now, on one machine the following code works

>>> import shelve
>>> d=shelve.open('d.dat')
>>>

while on the other...

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "local/lib/python2.5/shelve.py", line 225, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "local/lib/python2.5/shelve.py", line 209, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol,
writeback)
  File "local/lib/python2.5/anydbm.py", line 83, in open
    return mod.open(file, flag, mode)
  File "local/lib/python2.5/dbhash.py", line 16, in open
    return bsddb.hashopen(file, flag, mode)
  File "local/lib/python2.5/bsddb/__init__.py", line 299, in hashopen
    e = _openDBEnv(cachesize)
  File "local/lib/python2.5/bsddb/__init__.py", line 355, in
_openDBEnv
    e.set_lk_detect(db.DB_LOCK_DEFAULT)
bsddb.db.DBInvalidArgError: (22, 'Invalid argument')

What is happening? I am running the same Python interpreter on the
same file! Why different results? (To make things weirder, this
actually fails on the machine in which I created the d.dat file using
the shelve module!)

Please advise, knowledgeable pythoners! The archives are full of
references to this 22 invalid argument error msg, but precious few
anwers.

Cheers!

Max




More information about the Python-list mailing list