473,289 Members | 1,756 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,289 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 4600
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.