Several years ago I wrote a lengthy script to access Gramps data and generate custom reports. This script runs external to Gramps, importing Gramps modules from /usr/lib/.
After upgrading to Gramps version 5, my script is no longer able to open databases. The Gramps API documentation is very thorough when it comes to reading data from objects in the db, but it offers few clues on how to open the database itself. Sadly, I had to rely on some “cargo cult” code I found on Stack Exchange:
btspierre’s method worked great in previous versions, but unfortunately it doe does not work in version 5 and returns the following error:
ImportError: cannot import name ‘DbBsddb’ from ‘gramps.gen.db’ (/usr/lib/python3/dist-packages/gramps/gen/db/init.py)
From perusing the Gramps source code, It seems that DbState and DbBsddb are structured differently in the new version. Can someone offer some advice on how to externally open a Gramps Database in version 5?