471,330 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

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

Nov 1 '07 #1
1 4415
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.

Nov 1 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Rami A. Kishek | last post: by
1 post views Thread by Marco Bubke | last post: by
reply views Thread by Buster McFadden | last post: by
2 posts views Thread by Nemesis | last post: by
reply views Thread by Nemesis | last post: by
3 posts views Thread by Michele Petrazzo | last post: by
6 posts views Thread by aomighty | last post: by
13 posts views Thread by 7stud | last post: by
1 post views Thread by Matthew Schibler | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.