Skip to content

Commit

Permalink
access module properties to ensure modules are present
Browse files Browse the repository at this point in the history
demandimport wrappers such as mercurial prevent simple imports from triggering exceptions.
By accessing a property, the modules are actually loaded (or fail).

This should fix issue #177
  • Loading branch information
jsoref committed Apr 14, 2016
1 parent f2cc5db commit 170e40f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pudb/shell.py
@@ -1,5 +1,9 @@
try:
import IPython
# Access a property to verify module exists in case
# there's a demand loader wrapping module imports
# See https://github.com/inducer/pudb/issues/177
IPython.core
except (ImportError, ValueError):
# Old IPythons versions (0.12?) may fail to import with
# ValueError: fallback required, but not specified
Expand All @@ -10,6 +14,10 @@

try:
import bpython # noqa
# Access a property to verify module exists in case
# there's a demand loader wrapping module imports
# See https://github.com/inducer/pudb/issues/177
bpython.version
except ImportError:
HAVE_BPYTHON = False
else:
Expand Down

0 comments on commit 170e40f

Please sign in to comment.