Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd25c85

Browse files
committed
Add a better error message when IPython can't be found or doesn't have all the right stuff.
1 parent d5071f4 commit fd25c85

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

lib/matplotlib/sphinxext/ipython_directive.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,15 @@
8080
matplotlib.use('Agg')
8181

8282
# Our own
83-
from IPython import Config, InteractiveShell
84-
from IPython.core.profiledir import ProfileDir
85-
from IPython.utils import io
83+
try:
84+
from IPython import Config, InteractiveShell
85+
from IPython.core.profiledir import ProfileDir
86+
from IPython.utils import io
87+
except ImportError:
88+
raise ImportError(
89+
"Unable to import the necessary objects from IPython. "
90+
"You may need to install or upgrade your IPython installation.")
91+
8692

8793
#-----------------------------------------------------------------------------
8894
# Globals

0 commit comments

Comments
 (0)