From 65730a4de80b5446d4bd3301098c1c053af99b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 24 Nov 2002 08:26:01 +0000 Subject: Delete bsddb from sys.modules if _bsddb cannot be imported. --- Lib/bsddb/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py index a2d820c..1bec33b 100644 --- a/Lib/bsddb/__init__.py +++ b/Lib/bsddb/__init__.py @@ -43,7 +43,14 @@ People interested in the more advanced capabilites of Berkeley DB 3.x should use the bsddb3.db module directly. """ -import _bsddb +try: + import _bsddb +except ImportError: + # Remove ourselves from sys.modules + import sys + del sys.modules[__name__] + raise + # bsddb3 calls it _db _db = _bsddb __version__ = _db.__version__ -- cgit v0.12