Need someone to try some rarely used bsddb methods

Skip Montanaro skip at mojam.com
Sat Apr 17 09:08:39 EDT 1999




I noticed today that there is apparently still no documentation for the bsddb
module, so I started working on some.  While trying out the bsddb hash object
methods, I noticed a few didn't seem to work.  I tested this under Red Hat
Linux 5.0 (PC hardware) and Python 1.5.1.  I used Berkeley DB v 2.3.16 with
the backwards compatibility interface, so that might be causing my problems. 
I see no functional changes in the 1.5.2 version of the bsddb module, so I
doubt it's causing problems.

If you have the time, please try executing the following Python statements
and let me know what methods, if any, generate tracebacks.  I will need to
know what version of Python you used, what version of Berkeley DB you used,
and for completeness, what OS platform and version you used.  (If you use
version 2 of the DB library you will have to modify the bsddbmodule.c source
to include db_185.h instead of db.h.)

    import bsddb
    db = bsddb.hashopen("/tmp/spam.db", "c")
    for i in range(10): db["%d"%i] = "%d"% (i*i)
    db.keys()
    db.first()
    db.next()
    db.last()
    db.set_location('2')
    db.previous()
    db.sync()

The btree object (the one I use regularly) didn't have any problems.  The keys
returned with the record object seem to be screwed up:

    >>> db = bsddb.rnopen("/tmp/spamr.db", "c")
    >>> for i in range(10): db["%d"%i] = "%d"% (i*i)
    ...
    >>> db.keys()
    ['0\000\000\000', '1\000\000\000', '2\000\000\000', '3\000\000\000',
    '4\000\000\000', '5\000\000\000', '6\000\000\000', '7\000\000\000',
    '8\000\000\000', '9\000\000\000']

Can anyone confirm this rather odd behavior as well?

Private replies appreciated.

Thanks,

--
Skip Montanaro (skip at mojam.com, 518-372-5583)
Mojam: "Uniting the World of Music" http://www.mojam.com/
Musi-Cal: http://www.musi-cal.com/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




More information about the Python-list mailing list