Skip to content

Commit

Permalink
Merge pull request #2681 from tomspur/remove_matplotlib_dep
Browse files Browse the repository at this point in the history
Don't enable pylab mode, when matplotlib is not importable
  • Loading branch information
ellisonbg committed Feb 21, 2013
2 parents e64c0fa + b5d3927 commit df58e39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions IPython/core/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,10 @@ def enable_pylab(self, gui=None, import_all=True, welcome_message=False):
except KeyError:
error("Backend %r not supported" % gui)
return
except ImportError:
error("pylab mode doesn't work as matplotlib could not be found." + \
"\nIs it installed on the system?")
return
self.user_ns.update(ns)
self.user_ns_hidden.update(ns)
# Now we must activate the gui pylab wants to use, and fix %run to take
Expand Down
4 changes: 4 additions & 0 deletions IPython/core/shellapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def init_gui_pylab(self):
self.log.info("Enabling GUI event loop integration, "
"toolkit=%s" % self.gui)
shell.enable_gui(self.gui)
except ImportError:
self.log.warn("pylab mode doesn't work as matplotlib could not be found." + \
"\nIs it installed on the system?")
self.shell.showtraceback()
except Exception:
self.log.warn("GUI event loop or pylab initialization failed")
self.shell.showtraceback()
Expand Down

0 comments on commit df58e39

Please sign in to comment.