From d9b8269c3566971c1f5cd80550452e06f2fe860c Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sat, 25 Jun 2016 01:44:55 +0200 Subject: [PATCH] Do not exist with non-zero sys.exit() in case that matplotlib is not installed --- examples/show_butterfly.py | 3 ++- examples/show_model.py | 3 ++- examples/show_pha.py | 3 ++- examples/show_pull_evolution.py | 6 ++++-- examples/show_pull_histogram.py | 6 ++++-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/examples/show_butterfly.py b/examples/show_butterfly.py index 294084a..875afe5 100755 --- a/examples/show_butterfly.py +++ b/examples/show_butterfly.py @@ -23,7 +23,8 @@ import gammalib try: import matplotlib.pyplot as plt except: - sys.exit('This script needs the "matplotlib" module') + print('This script needs the "matplotlib" module') + sys.exit() # ============ # diff --git a/examples/show_model.py b/examples/show_model.py index 25d415a..d92a6cc 100755 --- a/examples/show_model.py +++ b/examples/show_model.py @@ -24,7 +24,8 @@ import gammalib try: import matplotlib.pyplot as plt except: - sys.exit('This script needs the "matplotlib" module') + print('This script needs the "matplotlib" module') + sys.exit() # ======================= # diff --git a/examples/show_pha.py b/examples/show_pha.py index e070435..b68c14c 100755 --- a/examples/show_pha.py +++ b/examples/show_pha.py @@ -24,7 +24,8 @@ import gammalib try: import matplotlib.pyplot as plt except: - sys.exit('This script needs the "matplotlib" module') + print('This script needs the "matplotlib" module') + sys.exit() # ================= # diff --git a/examples/show_pull_evolution.py b/examples/show_pull_evolution.py index 8361cda..22a47ec 100755 --- a/examples/show_pull_evolution.py +++ b/examples/show_pull_evolution.py @@ -23,11 +23,13 @@ import csv try: import matplotlib.pyplot as plt except: - sys.exit('This script needs the "matplotlib" module') + print('This script needs the "matplotlib" module') + sys.exit() try: import numpy as np except: - sys.exit('This script needs the "numpy" module') + print('This script needs the "numpy" module') + sys.exit() # ====================== # diff --git a/examples/show_pull_histogram.py b/examples/show_pull_histogram.py index 76aef81..957cced 100755 --- a/examples/show_pull_histogram.py +++ b/examples/show_pull_histogram.py @@ -24,11 +24,13 @@ try: import matplotlib.pyplot as plt import matplotlib.mlab as mlab except: - sys.exit('This script needs the "matplotlib" module') + print('This script needs the "matplotlib" module') + sys.exit() try: import numpy as np except: - sys.exit('This script needs the "numpy" module') + print('This script needs the "numpy" module') + sys.exit() # ====================== # -- libgit2 0.21.4