shelve broken on redhat 6.1

Marc Christiansen tolot at utolot.toppoint.de
Fri Feb 18 17:05:07 EST 2000


Skip <skip at mojam.com> wrote:
> There was a problem with whichdb.py in the 1.5.2 distribution that would
> cause anydbm, shelve and other packages that rely on anydbm to fail if
> anydbm tried to use bsddb and the libdb implementation underlying bsddb was
> version 2.x.  whichdb.py did not correctly detect version 2.x hash files.
> This has been fixed in the CVS repository.
> 
> Please try updating whichdb.py before reporting a bug.  You can pick up the
> latest version from
> 
>     http://www.musi-cal.com/~skip/python/Python/Lib/whichdb.py

Well, as I recently found out (being without any *db), there is another
problem with whichdb.py: It does not recognize the dumbdbm format. The
following patch is against the version from your page:

----------------
--- whichdb.py  Fri Feb 18 21:46:57 2000
+++ whichdb.py.new      Fri Feb 18 21:47:23 2000
@@ -25,6 +25,16 @@
     except IOError:
         pass
 
+    # Check for dumbdbm -- this has a .dat and a .dir file
+    try:
+        f = open(filename + ".dat", "rb")
+        f.close()
+        f = open(filename + ".dir", "rb")
+        f.close()
+        return "dumbdbm"
+    except IOError:
+        pass
+
     # See if the file exists, return None if not
     try:
         f = open(filename, "rb")
----------------

If the patch is ok, you can submit it. Or should I do it?

Ciao
  Marc



More information about the Python-list mailing list