From 801465fe8dbac9905ac74aeb5c3dc308d3328d98 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Fri, 23 Sep 2011 17:03:32 -0400
Subject: examples: fixed examples (pfb and tags) to print an error when python
 modules are not available.

---
 gnuradio-examples/python/pfb/chirp_channelize.py | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

(limited to 'gnuradio-examples/python/pfb/chirp_channelize.py')

diff --git a/gnuradio-examples/python/pfb/chirp_channelize.py b/gnuradio-examples/python/pfb/chirp_channelize.py
index edebf5f594..951255d3b0 100755
--- a/gnuradio-examples/python/pfb/chirp_channelize.py
+++ b/gnuradio-examples/python/pfb/chirp_channelize.py
@@ -21,10 +21,21 @@
 # 
 
 from gnuradio import gr, blks2
-import os, time
-import scipy, pylab
-from scipy import fftpack
-from pylab import mlab
+import sys, time
+
+try:
+    import scipy
+    from scipy import fftpack
+except ImportError:
+    print "Error: Program requires scipy (see: www.scipy.org)."
+    sys.exit(1)
+
+try:
+    import pylab
+    from pylab import mlab
+except ImportError:
+    print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+    sys.exit(1)
 
 class pfb_top_block(gr.top_block):
     def __init__(self):
-- 
cgit v1.2.3