diff --git a/pyglance/glance/compare.py b/pyglance/glance/compare.py index 628393278ffc4be5be3b2c2e8a412f6d4312c50f..da7e8179a309b21fb7b7db278238e50b154c3b10 100644 --- a/pyglance/glance/compare.py +++ b/pyglance/glance/compare.py @@ -19,8 +19,14 @@ from subprocess import check_call as sh from urllib import quote import matplotlib +# this is a hack to keep glance from needing pyqt unless you run the gui if "gui" in sys.argv[1:] : - matplotlib.use('Qt4Agg') + try : + matplotlib.use('Qt4Agg') + import glance.gui_controller as gui_control + except ImportError : + print ("*** Unable to import PyQt4. Please install PyQt4 and add it to your PYTHONPATH in order to use the Glance GUI. ***") + raise else : matplotlib.use('Agg') @@ -33,8 +39,6 @@ import glance.stats as statistics import glance.plotcreatefns as plotcreate import glance.collocation as collocation -import glance.gui_controller as gui_control - LOG = logging.getLogger(__name__) # these are the built in defaults for the settings