Guido van Rossum | 6700142 | 1996-01-25 18:33:39 +0000 | [diff] [blame] | 1 | """Provide a (g)dbm-compatible interface to bsdhash.hashopen.""" |
| 2 | |
Skip Montanaro | 438bb94 | 2001-01-25 13:47:00 +0000 | [diff] [blame] | 3 | import sys |
| 4 | try: |
| 5 | import bsddb |
| 6 | except ImportError: |
| 7 | # prevent a second import of this module from spuriously succeeding |
| 8 | del sys.modules[__name__] |
| 9 | raise |
Guido van Rossum | 6700142 | 1996-01-25 18:33:39 +0000 | [diff] [blame] | 10 | |
Skip Montanaro | e99d5ea | 2001-01-20 19:54:20 +0000 | [diff] [blame] | 11 | __all__ = ["error","open"] |
| 12 | |
Guido van Rossum | 287b399 | 1999-05-03 18:09:26 +0000 | [diff] [blame] | 13 | error = bsddb.error # Exported for anydbm |
Guido van Rossum | 6700142 | 1996-01-25 18:33:39 +0000 | [diff] [blame] | 14 | |
Guido van Rossum | 9f2b524 | 1998-07-03 14:16:55 +0000 | [diff] [blame] | 15 | def open(file, flag, mode=0666): |
Guido van Rossum | 6700142 | 1996-01-25 18:33:39 +0000 | [diff] [blame] | 16 | return bsddb.hashopen(file, flag, mode) |