Bugs item #1548332, was opened at 2006-08-29 07:51 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1548332&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extension Modules Group: Python 2.5 >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Curtis Doty (dotysan) Assigned to: Nobody/Anonymous (nobody) Summary: whichdb too dumb Initial Comment: On my system with db4, I noticed that whichdb doesn't know anything about more recent database types created by the bsddb module. Python 2.4.3 (#1, Jun 13 2006, 11:46:08) [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> from whichdb import * >>> import bsddb >>> >>> dbfile= "hash" >>> bsddb.hashopen( dbfile) {} >>> whichdb( dbfile) 'dbhash' >>> # yay ... >>> dbfile= "btree" >>> bsddb.btopen( dbfile) {} >>> whichdb( dbfile) '' >>> # bah ... >>> dbfile= "recno" >>> bsddb.rnopen( dbfile) {} >>> whichdb( dbfile) '' >>> # humbug! It looks like both these database types share: #define DB_BTREEMAGIC 0x053162 So this might be a start: --- Python-2.5c1/Lib/whichdb.py.orig 2005-02-05 22:57:08.000000000 -0800 +++ Python-2.5c1/Lib/whichdb.py 2006-08-28 13:46:57.000000000 -0700 @@ -109,6 +109,10 @@ if magic in (0x00061561, 0x61150600): return "dbhash" + # Check for binary tree + if magic == 0x00053162: + return "btree" + # Unknown return "" But alas, I'm not clear on the best way to differentiate between btree and recno. The above example is on 2.4 but persists in 2.5. ---------------------------------------------------------------------- >Comment By: Martin v. Löwis (loewis) Date: 2006-09-10 02:08 Message: Logged In: YES user_id=21627 It is not the job of whichdb to recognize certain database types created by the bsddb module. Instead, as the doc string says "Guess which db package to use to open a db file." The return value of whichdb is a *module name*. Since "btree" is not a module name, the proposed change is incorrect. Closing as invalid. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1548332&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com