Shelve problems with different python versions

cniekel at zonnet.nl cniekel at zonnet.nl
Tue Sep 5 15:21:47 EDT 2000


Hi,

I'm having trouble with shelve and different python "compiles".

The test-program is this:

#!/usr/bin/env python

import shelve

def test_read(file):
    print 'opening %s' % file

    s = shelve.open(file)

    print s.keys()

    s.close()

def test_write(file):
    print 'writing %s' % file

    s = shelve.open(file, 'w')
    s['foo'] = 'bar'
    s.close()

def test():
    file = 'shelvetest'

    test_read(file)
    test_write(file)

if __name__ == '__main__':
    test()


I have three different python's, 
 1. Debian: Python 1.5.2 (#0, Apr  3 2000, 14:46:48)
        [GCC 2.95.2 20000313 (Debian GNU/Linux)] on linux2
 2. Suse: Python 1.5.2 (#1, Nov  9 1999, 12:15:14)  
        [GCC egcs-2.91.66 19990314/Linux (egcs- on linux2
 3. 1.6b1: Python 1.6b1 (#6, Aug  6 2000, 20:43:21)  
        [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2


Each of the pythons runs the test program succesfully. The problem starts
when the pythons have to read anothers shelve.

First running Debian and then 1.6b1 gives me a AttributeError: open.
Debian created a 'dbhash' function, and 1.6b1 gives me a 'bsddb' import
exception.

Removing the file 'shelvetest' and creating a new file from 1.6b1 results
in a 'gdbm' file being created. Unfortunately, Debian then stops upon
loading the file with:
    gdbm.error: (13, 'Permission denied') 
(which doesn't make sense to me).

If I try to create the shelve with Suse (I might have changed some modules
a long time ago), it won't even start because:
        anydbm.error: db type could not be determined
The file didn't exist, but was apparently created in the load function. In
the write function, the program aborts with the above exception.
Apparently, my suse cannot deduce it's own shelve.

Anyway, 1.6 is out for about half an hour now, so I'll install that and
hope everything works then.

If anyone has any ideas about some special module I should install (or
not), I'd be glad to hear it.

Greetings,
    Chris Niekel




More information about the Python-list mailing list