From 801465fe8dbac9905ac74aeb5c3dc308d3328d98 Mon Sep 17 00:00:00 2001 From: Tom Rondeau 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/fmtest.py | 42 ++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'gnuradio-examples/python/pfb/fmtest.py') diff --git a/gnuradio-examples/python/pfb/fmtest.py b/gnuradio-examples/python/pfb/fmtest.py index 97df0e0f5..635ee4e9e 100755 --- a/gnuradio-examples/python/pfb/fmtest.py +++ b/gnuradio-examples/python/pfb/fmtest.py @@ -1,14 +1,42 @@ #!/usr/bin/env python # +# Copyright 2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, blks2 +import sys, math, 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 +except ImportError: + print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.exit(1) -from gnuradio import gr, eng_notation -from gnuradio import blks2 -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import math, time, sys, scipy, pylab -from scipy import fftpack - class fmtx(gr.hier_block2): def __init__(self, lo_freq, audio_rate, if_rate): -- cgit