Unable to use Gaudi with Python 3.13 when Gaudi is installed on CVMFS
Recently I deployed Gaudi with Python 3.13 on CVMFS and found out that running any algorithm was failing. The issue is related to the new default database (sqlite3), that seems not to be usable when in a read-only folder. I have reported this in https://github.com/python/cpython/issues/135386.
I think a way of going forward is to check the python version and if it's 3.13 (and maybe 3.14?) then change the default backend. Once a fix is merged we can check the patch version, maybe.
To make it work for us, I have used a patch that looks like this:
diff --git a/GaudiKernel/scripts/merge_confdb2_parts b/GaudiKernel/scripts/merge_confdb2_parts
index 7bb1d0444..08184a081 100755
--- a/GaudiKernel/scripts/merge_confdb2_parts
+++ b/GaudiKernel/scripts/merge_confdb2_parts
@@ -14,6 +14,7 @@ import os
import shelve
import sys
from optparse import OptionParser
+from dbm import gnu
from GaudiKernel.DataHandle import DataHandle # noqa: F401
from GaudiKernel.GaudiHandles import * # noqa: F401 F403
@@ -62,10 +63,12 @@ if __name__ == "__main__":
os.remove(output)
if sys.platform.startswith("darwin") and os.path.exists(output + ".db"):
os.remove(output + ".db")
- out = shelve.open(output)
+ out = gnu.open(output, 'c')
for input in inputs:
logging.debug("adding %r", input)
- out.update(eval(open(input, "rb").read()))
+ d = eval(open(input, "rb").read())
+ for key, value in d.items():
+ out[str(key)] = str(value)
out.close()
if sys.platform.startswith("darwin"):
if os.path.exists(output): # this Python uses dbm.gnu
which gives me the same database format as before 3.13 on Linux.
I'll copy the Python error for searching purposes:
dbm.sqlite3.error: attempt to write a readonly database
Edited by Juan Miguel Carceller