btree set_location() in new bsddb module \python 2.3.2\

andreyw at andreyw at
Mon Nov 3 10:22:13 EST 2003

btree set_location() method does not work properly
in new bsddb module. \ Python version 2.3.2 \

"...For binary tree databases (opened using btopen()), 
if key does not actually exist in the database,
the cursor will point to the next item in sorted order
and return that key and value." 

A. Weisberg

import bsddb

mode = 0666
flag = 'n' 
file = 'bt_test.bsd'

db = bsddb.btopen(file, flag, mode)

db['a'] = 'aa'
db['c'] = 'cc'

print db.set_location('b')

Traceback (most recent call last):
  File "C:\PYTHON23\lib\bsddb\", line 147, in set_location
    return self.dbc.set(key)
_bsddb.DBNotFoundError: (-30991, 'DB_NOTFOUND: No matching key/data 
pair found')

Sign up today for your Free E-mail at: 

More information about the Python-bugs-list mailing list