]> granicus.if.org Git - python/commitdiff
Delete bsddb from sys.modules if _bsddb cannot be imported.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 24 Nov 2002 08:26:01 +0000 (08:26 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 24 Nov 2002 08:26:01 +0000 (08:26 +0000)
Lib/bsddb/__init__.py

index a2d820c7853eb5d995ce1f1800e046ae72227206..1bec33bb50c917a175eb7b4405580920a893e486 100644 (file)
@@ -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__