From fe5ce888bb0302be9ead99b6fe3feccbc8564cf3 Mon Sep 17 00:00:00 2001
From: Duc Le <duc.le@stfc.ac.uk>
Date: Thu, 22 Sep 2016 13:31:48 +0100
Subject: [PATCH] Re #17557 - added def in case no mpl to print warning.

---
 scripts/PyChop/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/PyChop/__init__.py b/scripts/PyChop/__init__.py
index c02117e5437..3cf423faf01 100644
--- a/scripts/PyChop/__init__.py
+++ b/scripts/PyChop/__init__.py
@@ -17,9 +17,12 @@ resolution, flux = PyChop2.calculate(inst='maps', chtyp='a', freq=500, ei=600, e
 PyChop2.showGUI()
 """
 
+import warnings
 from .PyChop2 import PyChop2
 # If the system doesn't have matplotlib, don't import the GUI.
 try:
     from .PyChopGui import show as showGUI
 except ImportError:
-    pass
+    def showGUI():
+        warnings.warn("PyChop GUI disabled: Cannot import Matplotlib.", RuntimeWarning)
+        return None
-- 
GitLab