Delete bsddb from sys.modules if _bsddb cannot be imported.

This commit is contained in:
Martin v. Löwis 2002-11-24 08:26:01 +00:00
parent d332c085ea
commit 65730a4de8
1 changed files with 8 additions and 1 deletions

View 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__