f



shelve.open() and error 22: invalid argument

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

0
11/1/2007 8:08:18 PM
comp.lang.python 77058 articles. 6 followers. Post Follow

1 Replies
328 Views

Similar Articles

[PageSpeed] 19

On Nov 1, 1:08 pm, max.agin...@gmail.com wrote:
> 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!)
>

This comes up outside of Python as well. Look into your BDB setup. I
bet you that the two machines have different versions of BDB
libraries.

0
11/1/2007 8:41:13 PM
Reply: