I am trying to create a bsddb database where I would like to store all the relevant database files created by my application under one directory.
My code looks as follows:
When I run the script for the first time, it creates all the database files (__db.001
, __db.002, pidgin) in the current directory. When I run it for the second time, it behaves correctly and creates the database files in the dir specified while opening DBEnv. Is this a bug, or am I doing something wrong?
My environment: Windows, Python 2.4.3, bsddb 4.3.0.1
Thanks!
My code looks as follows:
Code:
from bsddb import db
from os import mkdir
from os.path import exists
homeDir = 'pidgindb'
db_env = db.DBEnv()
db_env.set_cachesize(0, 1024*1024*50)
if not exists(homeDir):
homeDir = mkdir(homeDir)
db_env.open(homeDir, db.DB_INIT_MPOOL|db.DB_CREATE)
pidgin = db.DB(db_env)
pidgin.open('pidgin',None,db.DB_BTREE,db.DB_CREATE,0660)
pidgin['apple'] = 'fruit'
pidgin['carrot'] = 'vegetable'
pidgin.close()
, __db.002, pidgin) in the current directory. When I run it for the second time, it behaves correctly and creates the database files in the dir specified while opening DBEnv. Is this a bug, or am I doing something wrong?
My environment: Windows, Python 2.4.3, bsddb 4.3.0.1
Thanks!
Comment