473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 4608
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rami A. Kishek | last post by:
Hi - this mysterious behavior with shelve is just about to kill me. I hope someone here can shed some light. First of all, I have this piece of code which uses shelve to save instances of some...
1
by: Marco Bubke | last post by:
Hi If I do shelve.open(filename='prim', protocol=pickle.HIGHEST_PROTOCOL, writeback=True) I get on some maschines(its the some python): Traceback (most recent call last):
0
by: Buster McFadden | last post by:
I've run into a problem on this platform (amd64) with code that works elsewhere, on x86, sparc, and ppc platforms. The shelve module is throwing an error raised from the anydbm call inside it: ...
2
by: Nemesis | last post by:
In the python docs about shelve module I read: ----------------------------------------------------------------------------- open( filename]]]) Open a persistent dictionary. The filename...
0
by: Nemesis | last post by:
Hi all, I'm having a problem with a shelve. I got (almost randomly) this error: Traceback (most recent call last): File "xpn.py", line 1082, in view_article...
3
by: Michele Petrazzo | last post by:
Hi, I'm trying a script on a debian 3.1 that has problems on shelve library. The same script work well on a fedora 2 and I don't know why it create this problem on debian: #extract from my code...
6
by: aomighty | last post by:
I wanted to write the following code: import shelve try: db = shelve.open(file, "r") except SomeError: print "Oh no, db not found" Only, I'm not sure what SomeError should be. I tried...
13
by: 7stud | last post by:
test1.py: -------------------- import shelve s = shelve.open("/Users/me/2testing/dir1/aaa.txt") s = "red" s.close() --------output:------ $ python test1.py
1
by: Matthew Schibler | last post by:
I'm a newbie to Python, with some experience using perl (where I used nested arrays and hashes extensively). I am building a script in python for a MUD I play, and I want to use the shelve module...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.