commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 07/20: python3: update gr-digital for pytho


From: git
Subject: [Commit-gnuradio] [gnuradio] 07/20: python3: update gr-digital for python3 support
Date: Sun, 25 Dec 2016 03:59:57 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch python3
in repository gnuradio.

commit 0e8e6ba82f1e8f2345e872347426e0662d93ba9f
Author: Douglas Anderson <address@hidden>
Date:   Thu Dec 22 12:51:34 2016 -0700

    python3: update gr-digital for python3 support
---
 gr-digital/examples/berawgn.py                     |  10 +-
 gr-digital/examples/example_costas.py              |   6 +-
 gr-digital/examples/example_fll.py                 |   6 +-
 gr-digital/examples/example_timing.py              |   6 +-
 .../examples/narrowband/benchmark_add_channel.py   |  18 +--
 gr-digital/examples/narrowband/benchmark_rx.py     |  28 ++--
 gr-digital/examples/narrowband/benchmark_tx.py     |  28 ++--
 gr-digital/examples/narrowband/digital_bert_rx.py  |  44 +++---
 gr-digital/examples/narrowband/receive_path.py     |  38 +++---
 gr-digital/examples/narrowband/rx_voice.py         |  38 +++---
 gr-digital/examples/narrowband/transmit_path.py    |  42 +++---
 gr-digital/examples/narrowband/tunnel.py           |  66 ++++-----
 gr-digital/examples/narrowband/tx_voice.py         |  40 +++---
 gr-digital/examples/narrowband/uhd_interface.py    |  92 ++++++-------
 gr-digital/examples/ofdm/benchmark_add_channel.py  |  20 +--
 gr-digital/examples/ofdm/transmit_path.py          |  28 ++--
 gr-digital/examples/ofdm/uhd_interface.py          |  70 +++++-----
 gr-digital/examples/run_length.py                  |  36 ++---
 gr-digital/examples/snr_estimators.py              |   8 +-
 gr-digital/python/digital/cpm.py                   | 104 ++++++++-------
 gr-digital/python/digital/generic_mod_demod.py     |  42 +++---
 gr-digital/python/digital/gfsk.py                  | 148 +++++++++++----------
 gr-digital/python/digital/gmsk.py                  | 128 +++++++++---------
 gr-digital/python/digital/ofdm.py                  |  84 ++++++------
 gr-digital/python/digital/ofdm_packet_utils.py     |  20 +--
 gr-digital/python/digital/ofdm_receiver.py         |  28 ++--
 gr-digital/python/digital/ofdm_sync_ml.py          |  33 +++--
 gr-digital/python/digital/ofdm_txrx.py             |   4 +-
 gr-digital/python/digital/packet_utils.py          |  26 ++--
 gr-digital/python/digital/pkt.py                   |  52 ++++----
 gr-digital/python/digital/psk.py                   |   2 +-
 gr-digital/python/digital/qam.py                   |   2 +-
 gr-digital/python/digital/soft_dec_lut_gen.py      |   4 +-
 gr-digital/python/digital/test_soft_decisions.py   |  24 ++--
 gr-digital/python/digital/utils/tagged_streams.py  |   2 +-
 35 files changed, 692 insertions(+), 635 deletions(-)

diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py
index c47d991..982d9f5 100755
--- a/gr-digital/examples/berawgn.py
+++ b/gr-digital/examples/berawgn.py
@@ -20,6 +20,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 """
 BER simulation for QPSK signals, compare to theoretical values.
 Change the N_BITS value to simulate more bits per Eb/N0 value,
@@ -43,13 +45,13 @@ import sys
 try:
     from scipy.special import erfc
 except ImportError:
-    print "Error: could not import scipy (http://www.scipy.org/)"
+    print("Error: could not import scipy (http://www.scipy.org/)")
     sys.exit(1)
 
 try:
     import pylab
 except ImportError:
-    print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+    print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
     sys.exit(1)
 
 # Best to choose powers of 10
@@ -112,7 +114,7 @@ class BERAWGNSimu(gr.top_block):
 
 def simulate_ber(EbN0):
     """ All the work's done here: create flow graph, run, read out BER """
-    print "Eb/N0 = %d dB" % EbN0
+    print("Eb/N0 = %d dB" % EbN0)
     fg = BERAWGNSimu(EbN0)
     fg.run()
     return numpy.sum(fg.sink.data())
@@ -122,7 +124,7 @@ if __name__ == "__main__":
     EbN0_max = 15
     EbN0_range = range(EbN0_min, EbN0_max+1)
     ber_theory = [berawgn(x)      for x in EbN0_range]
-    print "Simulating..."
+    print("Simulating...")
     ber_simu   = [simulate_ber(x) for x in EbN0_range]
 
     f = pylab.figure()
diff --git a/gr-digital/examples/example_costas.py 
b/gr-digital/examples/example_costas.py
index 77495d9..35e0e20 100755
--- a/gr-digital/examples/example_costas.py
+++ b/gr-digital/examples/example_costas.py
@@ -20,6 +20,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 from gnuradio import gr, digital, filter
 from gnuradio import blocks
 from gnuradio import channels
@@ -31,13 +33,13 @@ import sys
 try:
     import scipy
 except ImportError:
-    print "Error: could not import scipy (http://www.scipy.org/)"
+    print("Error: could not import scipy (http://www.scipy.org/)")
     sys.exit(1)
 
 try:
     import pylab
 except ImportError:
-    print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+    print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
     sys.exit(1)
 
 class example_costas(gr.top_block):
diff --git a/gr-digital/examples/example_fll.py 
b/gr-digital/examples/example_fll.py
index cda92ea..5e7e8ff 100755
--- a/gr-digital/examples/example_fll.py
+++ b/gr-digital/examples/example_fll.py
@@ -20,6 +20,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 from gnuradio import gr, digital, filter
 from gnuradio import blocks
 from gnuradio import channels
@@ -31,13 +33,13 @@ import sys
 try:
     import scipy
 except ImportError:
-    print "Error: could not import scipy (http://www.scipy.org/)"
+    print("Error: could not import scipy (http://www.scipy.org/)")
     sys.exit(1)
 
 try:
     import pylab
 except ImportError:
-    print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+    print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
     sys.exit(1)
 
 class example_fll(gr.top_block):
diff --git a/gr-digital/examples/example_timing.py 
b/gr-digital/examples/example_timing.py
index 9e8e3e0..b9fac29 100755
--- a/gr-digital/examples/example_timing.py
+++ b/gr-digital/examples/example_timing.py
@@ -20,6 +20,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 from gnuradio import gr, digital, filter
 from gnuradio import blocks
 from gnuradio import channels
@@ -31,13 +33,13 @@ import sys
 try:
     import scipy
 except ImportError:
-    print "Error: could not import scipy (http://www.scipy.org/)"
+    print("Error: could not import scipy (http://www.scipy.org/)")
     sys.exit(1)
 
 try:
     import pylab
 except ImportError:
-    print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+    print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
     sys.exit(1)
 
 from scipy import fftpack
diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py 
b/gr-digital/examples/narrowband/benchmark_add_channel.py
index cd85f4e..60aacf2 100755
--- a/gr-digital/examples/narrowband/benchmark_add_channel.py
+++ b/gr-digital/examples/narrowband/benchmark_add_channel.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2010,2011 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 __future__ import print_function
 
 from gnuradio import channels, gr
 from gnuradio import blocks
@@ -52,7 +54,7 @@ class my_top_block(gr.top_block):
         self.snk = blocks.file_sink(gr.sizeof_gr_complex, ofile)
 
         self.connect(self.src, self.channel, self.phase, self.snk)
-        
+
 
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
@@ -86,13 +88,13 @@ def main():
 
     ifile = args[0]
     ofile = args[1]
-        
+
     # build the graph
     tb = my_top_block(ifile, ofile, options)
 
     r = gr.enable_realtime_scheduling()
     if r != gr.RT_OK:
-        print "Warning: Failed to enable realtime scheduling."
+        print("Warning: Failed to enable realtime scheduling.")
 
     tb.start()        # start flow graph
     tb.wait()         # wait for it to finish
diff --git a/gr-digital/examples/narrowband/benchmark_rx.py 
b/gr-digital/examples/narrowband/benchmark_rx.py
index 09d923f..6d93af0 100755
--- a/gr-digital/examples/narrowband/benchmark_rx.py
+++ b/gr-digital/examples/narrowband/benchmark_rx.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2010,2011,2013 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 __future__ import print_function
 
 from gnuradio import gr, gru
 from gnuradio import blocks
@@ -37,7 +39,7 @@ import struct
 import sys
 
 #import os
-#print os.getpid()
+#print(os.getpid())
 #raw_input('Attach and press enter: ')
 
 class my_top_block(gr.top_block):
@@ -50,7 +52,7 @@ class my_top_block(gr.top_block):
             symbol_rate = options.bitrate / 
demodulator(**args).bits_per_symbol()
 
             self.source = uhd_receiver(options.args, symbol_rate,
-                                       options.samples_per_symbol, 
options.rx_freq, 
+                                       options.samples_per_symbol, 
options.rx_freq,
                                        options.lo_offset, options.rx_gain,
                                        options.spec, options.antenna,
                                        options.clock_source, options.verbose)
@@ -66,7 +68,7 @@ class my_top_block(gr.top_block):
         # Set up receive path
         # do this after for any adjustments to the options that may
         # occur in the sinks (specifically the UHD sink)
-        self.rxpath = receive_path(demodulator, rx_callback, options) 
+        self.rxpath = receive_path(demodulator, rx_callback, options)
 
         self.connect(self.source, self.rxpath)
 
@@ -82,7 +84,7 @@ def main():
 
     n_rcvd = 0
     n_right = 0
-    
+
     def rx_callback(ok, payload):
         global n_rcvd, n_right
         (pktno,) = struct.unpack('!H', payload[0:2])
@@ -90,8 +92,8 @@ def main():
         if ok:
             n_right += 1
 
-        print "ok = %5s  pktno = %4d  n_rcvd = %4d  n_right = %4d" % (
-            ok, pktno, n_rcvd, n_right)
+        print("ok = %5s  pktno = %4d  n_rcvd = %4d  n_right = %4d" % (
+            ok, pktno, n_rcvd, n_right))
 
     demods = digital.modulation_utils.type_1_demods()
 
@@ -99,7 +101,7 @@ def main():
     parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
     expert_grp = parser.add_option_group("Expert")
 
-    parser.add_option("-m", "--modulation", type="choice", 
choices=demods.keys(), 
+    parser.add_option("-m", "--modulation", type="choice", 
choices=demods.keys(),
                       default='psk',
                       help="Select modulation from: %s [default=%%default]"
                             % (', '.join(demods.keys()),))
@@ -130,7 +132,7 @@ def main():
 
     r = gr.enable_realtime_scheduling()
     if r != gr.RT_OK:
-        print "Warning: Failed to enable realtime scheduling."
+        print("Warning: Failed to enable realtime scheduling.")
 
     tb.start()        # start flow graph
     tb.wait()         # wait for it to finish
diff --git a/gr-digital/examples/narrowband/benchmark_tx.py 
b/gr-digital/examples/narrowband/benchmark_tx.py
index 2cb74d5..23f761f 100755
--- a/gr-digital/examples/narrowband/benchmark_tx.py
+++ b/gr-digital/examples/narrowband/benchmark_tx.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2010,2011,2013 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 __future__ import print_function
 
 from gnuradio import gr
 from gnuradio import blocks
@@ -35,8 +37,8 @@ from uhd_interface import uhd_transmitter
 
 import time, struct, sys
 
-#import os 
-#print os.getpid()
+#import os
+#print(os.getpid())
 #raw_input('Attach and press enter')
 
 class my_top_block(gr.top_block):
@@ -54,7 +56,7 @@ class my_top_block(gr.top_block):
                                         options.spec, options.antenna,
                                         options.clock_source, options.verbose)
             options.samples_per_symbol = self.sink._sps
-            
+
         elif(options.to_file is not None):
             sys.stderr.write(("Saving samples to '%s'.\n\n" % 
(options.to_file)))
             self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
@@ -109,7 +111,7 @@ def main():
     if len(args) != 0:
         parser.print_help()
         sys.exit(1)
-           
+
     if options.from_file is not None:
         source_file = open(options.from_file, 'r')
 
@@ -118,10 +120,10 @@ def main():
 
     r = gr.enable_realtime_scheduling()
     if r != gr.RT_OK:
-        print "Warning: failed to enable realtime scheduling"
+        print("Warning: failed to enable realtime scheduling")
 
     tb.start()                       # start flow graph
-        
+
     # generate and send packets
     nbytes = int(1e6 * options.megabytes)
     n = 0
@@ -130,7 +132,7 @@ def main():
 
     while n < nbytes:
         if options.from_file is None:
-            data = (pkt_size - 2) * chr(pktno & 0xff) 
+            data = (pkt_size - 2) * chr(pktno & 0xff)
         else:
             data = source_file.read(pkt_size - 2)
             if data == '':
@@ -143,7 +145,7 @@ def main():
         if options.discontinuous and pktno % 5 == 4:
             time.sleep(1)
         pktno += 1
-        
+
     send_pkt(eof=True)
 
     tb.wait()                       # wait for it to finish
diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py 
b/gr-digital/examples/narrowband/digital_bert_rx.py
index c04c767..374a614 100755
--- a/gr-digital/examples/narrowband/digital_bert_rx.py
+++ b/gr-digital/examples/narrowband/digital_bert_rx.py
@@ -20,6 +20,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 from gnuradio import gr, eng_notation
 from optparse import OptionParser
 from gnuradio.eng_option import eng_option
@@ -44,8 +46,8 @@ class status_thread(_threading.Thread):
 
     def run(self):
         while not self.done:
-            print "Freq. Offset: {0:5.0f} Hz  Timing Offset: {1:10.1f} ppm  
Estimated SNR: {2:4.1f} dB  BER: {3:g}".format(
-                tb.frequency_offset(), tb.timing_offset()*1e6, tb.snr(), 
tb.ber())
+            print("Freq. Offset: {0:5.0f} Hz  Timing Offset: {1:10.1f} ppm  
Estimated SNR: {2:4.1f} dB  BER: {3:g}".format(
+                tb.frequency_offset(), tb.timing_offset()*1e6, tb.snr(), 
tb.ber()))
             try:
                 time.sleep(1.0)
             except KeyboardInterrupt:
@@ -63,10 +65,10 @@ class bert_receiver(gr.hier_block2):
         gr.hier_block2.__init__(self, "bert_receive",
                                 gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
                                 gr.io_signature(0, 0, 0))                    # 
Output signature
-        
+
         self._bitrate = bitrate
 
-        self._demod = digital.generic_demod(constellation, differential, 
+        self._demod = digital.generic_demod(constellation, differential,
                                             samples_per_symbol,
                                             gray_coded, excess_bw,
                                             freq_bw, timing_bw, phase_bw,
@@ -79,13 +81,13 @@ class bert_receiver(gr.hier_block2):
         self._snr_probe = digital.probe_mpsk_snr_est_c(digital.SNR_EST_M2M4, 
1000,
                                                        
alpha=10.0/self._symbol_rate)
         self.connect(self._demod.time_recov, self._snr_probe)
-        
+
         # Descramble BERT sequence.  A channel error will create 3 incorrect 
bits
         self._descrambler = digital.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 
7-bit descrambler
 
         # Measure BER by the density of 0s in the stream
         self._ber = digital.probe_density_b(1.0/self._symbol_rate)
-        
+
         self.connect(self, self._demod, self._descrambler, self._ber)
 
     def frequency_offset(self):
@@ -105,15 +107,15 @@ class bert_receiver(gr.hier_block2):
 class rx_psk_block(gr.top_block):
     def __init__(self, demod, options):
 
-       gr.top_block.__init__(self, "rx_mpsk")
+        gr.top_block.__init__(self, "rx_mpsk")
 
         self._demodulator_class = demod
 
         # Get demod_kwargs
         demod_kwargs = 
self._demodulator_class.extract_kwargs_from_options(options)
-        
+
         # demodulator
-       self._demodulator = self._demodulator_class(**demod_kwargs)
+        self._demodulator = self._demodulator_class(**demod_kwargs)
 
         if(options.rx_freq is not None):
             symbol_rate = options.bitrate / self._demodulator.bits_per_symbol()
@@ -131,17 +133,17 @@ class rx_psk_block(gr.top_block):
 
         # Create the BERT receiver
         self._receiver = bert_receiver(options.bitrate,
-                                       self._demodulator._constellation, 
+                                       self._demodulator._constellation,
                                        options.samples_per_symbol,
-                                       options.differential, 
-                                       options.excess_bw, 
+                                       options.differential,
+                                       options.excess_bw,
                                        gray_coded=True,
                                        freq_bw=options.freq_bw,
                                        timing_bw=options.timing_bw,
                                        phase_bw=options.phase_bw,
                                        verbose=options.verbose,
                                        log=options.log)
-        
+
         self.connect(self._source, self._receiver)
 
     def snr(self):
@@ -149,7 +151,7 @@ class rx_psk_block(gr.top_block):
 
     def mag(self):
         return self._receiver.signal_mean()
-        
+
     def var(self):
         return self._receiver.noise_variance()
 
@@ -158,16 +160,16 @@ class rx_psk_block(gr.top_block):
 
     def frequency_offset(self):
         return self._receiver.frequency_offset()
-        
+
     def timing_offset(self):
         return self._receiver.timing_offset()
-            
+
 
 def get_options(demods):
     parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
     parser.add_option("","--from-file", default=None,
                       help="input file of samples to demod")
-    parser.add_option("-m", "--modulation", type="choice", 
choices=demods.keys(), 
+    parser.add_option("-m", "--modulation", type="choice", 
choices=demods.keys(),
                       default='psk',
                       help="Select modulation from: %s [default=%%default]"
                             % (', '.join(demods.keys()),))
@@ -186,12 +188,12 @@ def get_options(demods):
     demods = digital.modulation_utils.type_1_demods()
     for mod in demods.values():
         mod.add_options(parser)
-                     
+
     (options, args) = parser.parse_args()
     if len(args) != 0:
         parser.print_help()
         sys.exit(1)
-       
+
     return (options, args)
 
 
@@ -203,8 +205,8 @@ if __name__ == "__main__":
     demod = demods[options.modulation]
     tb = rx_psk_block(demod, options)
 
-    print "\n*** SNR estimator is inaccurate below about 7dB"
-    print "*** BER estimator is inaccurate above about 10%\n"
+    print("\n*** SNR estimator is inaccurate below about 7dB")
+    print("*** BER estimator is inaccurate above about 10%\n")
     updater = status_thread(tb)
 
     try:
diff --git a/gr-digital/examples/narrowband/receive_path.py 
b/gr-digital/examples/narrowband/receive_path.py
index 8bbfe92..1fd4e33 100644
--- a/gr-digital/examples/narrowband/receive_path.py
+++ b/gr-digital/examples/narrowband/receive_path.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2005-2007,2011 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 __future__ import print_function
 
 from gnuradio import gr, gru, filter
 from gnuradio import eng_notation
@@ -34,10 +36,10 @@ import sys
 
 class receive_path(gr.hier_block2):
     def __init__(self, demod_class, rx_callback, options):
-       gr.hier_block2.__init__(self, "receive_path",
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex),
-                               gr.io_signature(0, 0, 0))
-        
+        gr.hier_block2.__init__(self, "receive_path",
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
+                                gr.io_signature(0, 0, 0))
+
         options = copy.copy(options)    # make a copy so we can destructively 
modify
 
         self._verbose     = options.verbose
@@ -59,7 +61,7 @@ class receive_path(gr.hier_block2):
         if(self._chbw_factor < 1.0 or self._chbw_factor > 
self.samples_per_symbol()/2):
             sys.stderr.write("Channel bandwidth factor ({0}) must be within 
the range [1.0, {1}].\n".format(self._chbw_factor, self.samples_per_symbol()/2))
             sys.exit(1)
-        
+
         # Design filter to get actual channel we want
         sw_decim = 1
         chan_coeffs = filter.firdes.low_pass(1.0,                  # gain
@@ -68,7 +70,7 @@ class receive_path(gr.hier_block2):
                                              0.5,                  # width of 
trans. band
                                              filter.firdes.WIN_HANN)   # 
filter type
         self.channel_filter = filter.fft_filter_ccc(sw_decim, chan_coeffs)
-        
+
         # receiver
         self.packet_receiver = \
             digital.demod_pkts(self.demodulator,
@@ -85,8 +87,8 @@ class receive_path(gr.hier_block2):
         if self._verbose:
             self._print_verbage()
 
-       # connect block input to channel filter
-       self.connect(self, self.channel_filter)
+        # connect block input to channel filter
+        self.connect(self, self.channel_filter)
 
         # connect the channel input filter to the carrier power detector
         self.connect(self.channel_filter, self.probe)
@@ -145,8 +147,8 @@ class receive_path(gr.hier_block2):
         """
         Prints information about the receive path
         """
-        print "\nReceive Path:"
-        print "modulation:      %s"    % (self._demod_class.__name__)
-        print "bitrate:         %sb/s" % 
(eng_notation.num_to_str(self._bitrate))
-        print "samples/symbol:  %.4f"    % (self.samples_per_symbol())
-        print "Differential:    %s"    % (self.differential())
+        print("\nReceive Path:")
+        print("modulation:      %s"    % (self._demod_class.__name__))
+        print("bitrate:         %sb/s" % 
(eng_notation.num_to_str(self._bitrate)))
+        print("samples/symbol:  %.4f"    % (self.samples_per_symbol()))
+        print("Differential:    %s"    % (self.differential()))
diff --git a/gr-digital/examples/narrowband/rx_voice.py 
b/gr-digital/examples/narrowband/rx_voice.py
index 8a0e984..e3b703e 100755
--- a/gr-digital/examples/narrowband/rx_voice.py
+++ b/gr-digital/examples/narrowband/rx_voice.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2005,2006,2009,2011,2013 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 __future__ import print_function
 
 from gnuradio import gr, audio, uhd
 from gnuradio import blocks
@@ -40,16 +42,16 @@ from receive_path import receive_path
 from uhd_interface import uhd_receiver
 
 #import os
-#print os.getpid()
+#print(os.getpid())
 #raw_input('Attach and press enter')
 
 
 class audio_tx(gr.hier_block2):
     def __init__(self, audio_output_dev):
-       gr.hier_block2.__init__(self, "audio_tx",
-                               gr.io_signature(0, 0, 0), # Input signature
-                               gr.io_signature(0, 0, 0)) # Output signature
-                               
+        gr.hier_block2.__init__(self, "audio_tx",
+                                gr.io_signature(0, 0, 0), # Input signature
+                                gr.io_signature(0, 0, 0)) # Output signature
+
         self.sample_rate = sample_rate = 8000
         self.packet_src = blocks.message_source(33)
         voice_decoder = vocoder.gsm_fr_decode_ps()
@@ -57,7 +59,7 @@ class audio_tx(gr.hier_block2):
         sink_scale = blocks.multiply_const_ff(1.0/32767.)
         audio_sink = audio.sink(sample_rate, audio_output_dev)
         self.connect(self.packet_src, voice_decoder, s2f, sink_scale, 
audio_sink)
-        
+
     def msgq(self):
         return self.packet_src.msgq()
 
@@ -79,7 +81,7 @@ class my_top_block(gr.top_block):
             usrp_rate = self.source.get_sample_rate()
             rrate = audio_rate / usrp_rate
             self.resampler = filter.pfb.arb_resampler_ccf(rrate)
-            
+
             self.connect(self.source, self.resampler, self.rxpath)
 
         elif(options.from_file is not None):
@@ -92,7 +94,7 @@ class my_top_block(gr.top_block):
             self.source = blocks.null_source(gr.sizeof_gr_complex)
             self.connect(self.source, self.thr, self.rxpath)
 
-       self.connect(self.audio_tx)        
+        self.connect(self.audio_tx)
 
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
@@ -105,7 +107,7 @@ def main():
 
     n_rcvd = 0
     n_right = 0
-    
+
     def rx_callback(ok, payload):
         global n_rcvd, n_right
         n_rcvd += 1
@@ -113,8 +115,8 @@ def main():
             n_right += 1
 
         tb.audio_tx.msgq().insert_tail(gr.message_from_string(payload))
-        
-        print "ok = %r  n_rcvd = %4d  n_right = %4d" % (
+
+        print("ok = %r  n_rcvd = %4d  n_right = %4d" % ()
             ok, n_rcvd, n_right)
 
     demods = digital.modulation_utils.type_1_demods()
@@ -123,7 +125,7 @@ def main():
     parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
     expert_grp = parser.add_option_group("Expert")
 
-    parser.add_option("-m", "--modulation", type="choice", 
choices=demods.keys(), 
+    parser.add_option("-m", "--modulation", type="choice", 
choices=demods.keys(),
                       default='gmsk',
                       help="Select modulation from: %s [default=%%default]"
                             % (', '.join(demods.keys()),))
@@ -156,7 +158,7 @@ def main():
 
     r = gr.enable_realtime_scheduling()
     if r != gr.RT_OK:
-        print "Warning: Failed to enable realtime scheduling."
+        print("Warning: Failed to enable realtime scheduling.")
 
     tb.run()
 
diff --git a/gr-digital/examples/narrowband/transmit_path.py 
b/gr-digital/examples/narrowband/transmit_path.py
index 70b4044..ea9c0e8 100644
--- a/gr-digital/examples/narrowband/transmit_path.py
+++ b/gr-digital/examples/narrowband/transmit_path.py
@@ -1,23 +1,25 @@
 #
 # Copyright 2005-2007,2011 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 __future__ import print_function
 
 from gnuradio import gr
 from gnuradio import eng_notation
@@ -36,10 +38,10 @@ class transmit_path(gr.hier_block2):
         '''
         See below for what options should hold
         '''
-       gr.hier_block2.__init__(self, "transmit_path",
-                               gr.io_signature(0,0,0),
-                               gr.io_signature(1,1,gr.sizeof_gr_complex))
-        
+        gr.hier_block2.__init__(self, "transmit_path",
+                                gr.io_signature(0,0,0),
+                                gr.io_signature(1,1,gr.sizeof_gr_complex))
+
         options = copy.copy(options)    # make a copy so we can destructively 
modify
 
         self._verbose      = options.verbose
@@ -49,10 +51,10 @@ class transmit_path(gr.hier_block2):
 
         # Get mod_kwargs
         mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
-        
+
         # transmitter
-       self.modulator = self._modulator_class(**mod_kwargs)
-        
+        self.modulator = self._modulator_class(**mod_kwargs)
+
         self.packet_transmitter = \
             digital.mod_pkts(self.modulator,
                              access_code=None,
@@ -72,19 +74,19 @@ class transmit_path(gr.hier_block2):
     def set_tx_amplitude(self, ampl):
         """
         Sets the transmit amplitude sent to the USRP in volts
-        
+
         Args:
             : ampl 0 <= ampl < 1.
         """
         self._tx_amplitude = max(0.0, min(ampl, 1))
         self.amp.set_k(self._tx_amplitude)
-        
+
     def send_pkt(self, payload='', eof=False):
         """
         Calls the transmitter method to send a packet
         """
         return self.packet_transmitter.send_pkt(payload, eof)
-        
+
     def bitrate(self):
         return self._bitrate
 
@@ -120,8 +122,8 @@ class transmit_path(gr.hier_block2):
         """
         Prints information about the transmit path
         """
-        print "Tx amplitude     %s"    % (self._tx_amplitude)
-        print "modulation:      %s"    % (self._modulator_class.__name__)
-        print "bitrate:         %sb/s" % 
(eng_notation.num_to_str(self._bitrate))
-        print "samples/symbol:  %.4f"  % (self.samples_per_symbol())
-        print "Differential:    %s"    % (self.differential())
+        print("Tx amplitude     %s"    % (self._tx_amplitude))
+        print("modulation:      %s"    % (self._modulator_class.__name__))
+        print("bitrate:         %sb/s" % 
(eng_notation.num_to_str(self._bitrate)))
+        print("samples/symbol:  %.4f"  % (self.samples_per_symbol()))
+        print("Differential:    %s"    % (self.differential()))
diff --git a/gr-digital/examples/narrowband/tunnel.py 
b/gr-digital/examples/narrowband/tunnel.py
index 7b9b69c..fafb643 100755
--- a/gr-digital/examples/narrowband/tunnel.py
+++ b/gr-digital/examples/narrowband/tunnel.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2005,2006,2009,2011 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 __future__ import print_function
 
 
 # ////////////////////////////////////////////////////////////////////
@@ -49,7 +51,7 @@ from uhd_interface import uhd_receiver
 import os, sys
 import random, time, struct
 
-#print os.getpid()
+#print(os.getpid())
 #raw_input('Attach and press enter')
 
 # ////////////////////////////////////////////////////////////////////
@@ -71,7 +73,7 @@ IFF_ONE_QUEUE = 0x2000   # beats me ;)
 
 def open_tun_interface(tun_device_filename):
     from fcntl import ioctl
-    
+
     mode = IFF_TAP | IFF_NO_PI
     TUNSETIFF = 0x400454ca
 
@@ -79,7 +81,7 @@ def open_tun_interface(tun_device_filename):
     ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode))
     ifname = ifs[:16].strip("\x00")
     return (tun, ifname)
-    
+
 
 # ////////////////////////////////////////////////////////////////////
 #                     the flow graph
@@ -101,13 +103,13 @@ class my_top_block(gr.top_block):
                                    options.rx_freq, options.rx_gain,
                                    options.spec, options.antenna,
                                    options.verbose)
-        
+
         self.sink = uhd_transmitter(options.args, symbol_rate,
                                     options.samples_per_symbol,
                                     options.tx_freq, options.tx_gain,
                                     options.spec, options.antenna,
                                     options.verbose)
-        
+
         options.samples_per_symbol = self.source._sps
 
         self.txpath = transmit_path(mod_class, options)
@@ -131,7 +133,7 @@ class my_top_block(gr.top_block):
 
         self.sink.set_freq(target_freq)
         self.source.set_freq(target_freq)
-        
+
 
 # ////////////////////////////////////////////////////////////////////
 #                           Carrier Sense MAC
@@ -166,7 +168,7 @@ class cs_mac(object):
             payload: contents of the packet (string)
         """
         if self.verbose:
-            print "Rx: ok = %r  len(payload) = %4d" % (ok, len(payload))
+            print("Rx: ok = %r  len(payload) = %4d" % (ok, len(payload)))
         if ok:
             os.write(self.tun_fd, payload)
 
@@ -186,7 +188,7 @@ class cs_mac(object):
                 break
 
             if self.verbose:
-                print "Tx: len(payload) = %4d" % (len(payload),)
+                print("Tx: len(payload) = %4d" % (len(payload),))
 
             delay = min_delay
             while self.tb.carrier_sensed():
@@ -247,7 +249,7 @@ def main():
         realtime = True
     else:
         realtime = False
-        print "Note: failed to enable realtime scheduling"
+        print("Note: failed to enable realtime scheduling")
 
     # instantiate the MAC
     mac = cs_mac(tun_fd, verbose=True)
@@ -261,26 +263,26 @@ def main():
     mac.set_top_block(tb)    # give the MAC a handle for the PHY
 
     if tb.txpath.bitrate() != tb.rxpath.bitrate():
-        print "WARNING: Transmit bitrate = %sb/sec, Receive bitrate = %sb/sec" 
% (
+        print("WARNING: Transmit bitrate = %sb/sec, Receive bitrate = %sb/sec" 
% (
             eng_notation.num_to_str(tb.txpath.bitrate()),
-            eng_notation.num_to_str(tb.rxpath.bitrate()))
-             
-    print "modulation:     %s"   % (options.modulation,)
-    print "freq:           %s"      % 
(eng_notation.num_to_str(options.tx_freq))
-    print "bitrate:        %sb/sec" % 
(eng_notation.num_to_str(tb.txpath.bitrate()),)
-    print "samples/symbol: %3d" % (tb.txpath.samples_per_symbol(),)
+            eng_notation.num_to_str(tb.rxpath.bitrate())))
+
+    print("modulation:     %s"   % (options.modulation,))
+    print("freq:           %s"      % 
(eng_notation.num_to_str(options.tx_freq)))
+    print("bitrate:        %sb/sec" % 
(eng_notation.num_to_str(tb.txpath.bitrate()),))
+    print("samples/symbol: %3d" % (tb.txpath.samples_per_symbol(),))
 
     tb.rxpath.set_carrier_threshold(options.carrier_threshold)
-    print "Carrier sense threshold:", options.carrier_threshold, "dB"
-    
-    print
-    print "Allocated virtual ethernet interface: %s" % (tun_ifname,)
-    print "You must now use ifconfig to set its IP address. E.g.,"
-    print
-    print "  $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,)
-    print
-    print "Be sure to use a different address in the same subnet for each 
machine."
-    print
+    print("Carrier sense threshold:", options.carrier_threshold, "dB")
+
+    print()
+    print("Allocated virtual ethernet interface: %s" % (tun_ifname,))
+    print("You must now use ifconfig to set its IP address. E.g.,")
+    print()
+    print("  $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,))
+    print()
+    print("Be sure to use a different address in the same subnet for each 
machine.")
+    print()
 
 
     tb.start()    # Start executing the flow graph (runs in separate threads)
@@ -289,7 +291,7 @@ def main():
 
     tb.stop()     # but if it does, tell flow graph to stop.
     tb.wait()     # wait for it to finish
-                
+
 
 if __name__ == '__main__':
     try:
diff --git a/gr-digital/examples/narrowband/tx_voice.py 
b/gr-digital/examples/narrowband/tx_voice.py
index afdb440..9e52b89 100755
--- a/gr-digital/examples/narrowband/tx_voice.py
+++ b/gr-digital/examples/narrowband/tx_voice.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2005-2007,2009,2011,2013 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 __future__ import print_function
 
 from gnuradio import gr, audio, uhd
 from gnuradio import eng_notation
@@ -40,15 +42,15 @@ from transmit_path import transmit_path
 from uhd_interface import uhd_transmitter
 
 #import os
-#print os.getpid()
+#print(os.getpid())
 #raw_input('Attach and press enter')
 
 
 class audio_rx(gr.hier_block2):
     def __init__(self, audio_input_dev):
-       gr.hier_block2.__init__(self, "audio_rx",
-                               gr.io_signature(0, 0, 0), # Input signature
-                               gr.io_signature(0, 0, 0)) # Output signature
+        gr.hier_block2.__init__(self, "audio_rx",
+                                gr.io_signature(0, 0, 0), # Input signature
+                                gr.io_signature(0, 0, 0)) # Output signature
         self.sample_rate = sample_rate = 8000
         src = audio.source(sample_rate, audio_input_dev)
         src_scale = blocks.multiply_const_ff(32767)
@@ -60,7 +62,7 @@ class audio_rx(gr.hier_block2):
 
     def get_encoded_voice_packet(self):
         return self.packets_from_encoder.delete_head()
-        
+
 
 class my_top_block(gr.top_block):
 
@@ -78,7 +80,7 @@ class my_top_block(gr.top_block):
             audio_rate = self.audio_rx.sample_rate
             usrp_rate = self.sink.get_sample_rate()
             rrate = usrp_rate / audio_rate
-            
+
         elif(options.to_file is not None):
             self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
             rrate = 1
@@ -87,10 +89,10 @@ class my_top_block(gr.top_block):
             rrate = 1
 
         self.resampler = filter.pfb.arb_resampler_ccf(rrate)
-            
-       self.connect(self.audio_rx)
-       self.connect(self.txpath, self.resampler, self.sink)
-            
+
+        self.connect(self.audio_rx)
+        self.connect(self.txpath, self.resampler, self.sink)
+
 
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
@@ -102,7 +104,7 @@ def main():
         return tb.txpath.send_pkt(payload, eof)
 
     def rx_callback(ok, payload):
-        print "ok = %r, payload = '%s'" % (ok, payload)
+        print("ok = %r, payload = '%s'" % (ok, payload))
 
     mods = digital.modulation_utils.type_1_mods()
 
@@ -144,7 +146,7 @@ def main():
 
     r = gr.enable_realtime_scheduling()
     if r != gr.RT_OK:
-        print "Warning: failed to enable realtime scheduling"
+        print("Warning: failed to enable realtime scheduling")
 
 
     tb.start()                       # start flow graph
@@ -161,7 +163,7 @@ def main():
         n += len(s)
         sys.stderr.write('.')
         pktno += 1
-        
+
     send_pkt(eof=True)
     tb.wait()                       # wait for it to finish
 
@@ -170,4 +172,4 @@ if __name__ == '__main__':
     try:
         main()
     except KeyboardInterrupt:
-       pass
+        pass
diff --git a/gr-digital/examples/narrowband/uhd_interface.py 
b/gr-digital/examples/narrowband/uhd_interface.py
index e7c7fe3..7eb1196 100644
--- a/gr-digital/examples/narrowband/uhd_interface.py
+++ b/gr-digital/examples/narrowband/uhd_interface.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2010,2011 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 __future__ import print_function
 
 from gnuradio import gr, uhd
 from gnuradio import eng_notation
@@ -44,7 +46,7 @@ def add_freq_option(parser):
 class uhd_interface:
     def __init__(self, istx, args, sym_rate, sps, freq=None, lo_offset=None,
                  gain=None, spec=None, antenna=None, clock_source=None):
-        
+
         if(istx):
             self.u = uhd.usrp_sink(device_addr=args, 
stream_args=uhd.stream_args('fc32'))
         else:
@@ -61,15 +63,15 @@ class uhd_interface:
         # Set the antenna
         if(antenna):
             self.u.set_antenna(antenna, 0)
-        
+
         self._args = args
         self._ant  = antenna
         self._spec = spec
         self._gain = self.set_gain(gain)
-        self._lo_offset = lo_offset 
-        self._freq = self.set_freq(freq, lo_offset) 
+        self._lo_offset = lo_offset
+        self._freq = self.set_freq(freq, lo_offset)
         self._rate, self._sps = self.set_sample_rate(sym_rate, sps)
-        self._clock_source = clock_source 
+        self._clock_source = clock_source
 
     def set_sample_rate(self, sym_rate, req_sps):
         start_sps = req_sps
@@ -84,31 +86,31 @@ class uhd_interface:
             else:
                 actual_sps = sps
                 break
-        
+
         if(sps != req_sps):
-            print "\nSymbol Rate:         %f" % (sym_rate)
-            print "Requested sps:       %f" % (start_sps)
-            print "Given sample rate:   %f" % (actual_samp_rate)
-            print "Actual sps for rate: %f" % (actual_sps)
+            print("\nSymbol Rate:         %f" % (sym_rate))
+            print("Requested sps:       %f" % (start_sps))
+            print("Given sample rate:   %f" % (actual_samp_rate))
+            print("Actual sps for rate: %f" % (actual_sps))
 
         if(actual_samp_rate != asked_samp_rate):
-            print "\nRequested sample rate: %f" % (asked_samp_rate)
-            print "Actual sample rate: %f" % (actual_samp_rate)
+            print("\nRequested sample rate: %f" % (asked_samp_rate))
+            print("Actual sample rate: %f" % (actual_samp_rate))
 
         return (actual_samp_rate, actual_sps)
 
     def get_sample_rate(self):
         return self.u.get_samp_rate()
-    
+
     def set_gain(self, gain=None):
         if gain is None:
             # if no gain was specified, use the mid-point in dB
             g = self.u.get_gain_range()
             gain = float(g.start()+g.stop())/2
-            print "\nNo gain specified."
-            print "Setting gain to %f (from [%f, %f])" % \
-                (gain, g.start(), g.stop())
-        
+            print("\nNo gain specified.")
+            print("Setting gain to %f (from [%f, %f])" %
+                (gain, g.start(), g.stop()))
+
         self.u.set_gain(gain, 0)
         return gain
 
@@ -116,7 +118,7 @@ class uhd_interface:
         if(freq is None):
             sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
             sys.exit(1)
-        
+
         r = self.u.set_center_freq(uhd.tune_request(freq, lo_offset))
         if r:
             return freq
@@ -163,22 +165,22 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
         parser.add_option("", "--tx-gain", type="eng_float", default=None,
                           help="set transmit gain in dB (default is midpoint)")
         parser.add_option("-C", "--clock-source", type="string", default=None,
-                          help="select clock source (e.g. 'external') 
[default=%default]") 
+                          help="select clock source (e.g. 'external') 
[default=%default]")
         parser.add_option("-v", "--verbose", action="store_true", 
default=False)
 
     def _print_verbage(self):
         """
         Prints information about the UHD transmitter
         """
-        print "\nUHD Transmitter:"
-        print "Args:     %s"    % (self._args)
-        print "Freq:        %sHz"  % (eng_notation.num_to_str(self._freq))
-        print "LO Offset:    %sHz"  % 
(eng_notation.num_to_str(self._lo_offset)) 
-        print "Gain:        %f dB" % (self._gain)
-        print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
-        print "Antenna:     %s"    % (self._ant)
-        print "Subdev Spec:  %s"   % (self._spec)
-        print "Clock Source: %s"    % (self._clock_source)
+        print("\nUHD Transmitter:")
+        print("Args:     %s"    % (self._args))
+        print("Freq:        %sHz"  % (eng_notation.num_to_str(self._freq)))
+        print("LO Offset:    %sHz"  % 
(eng_notation.num_to_str(self._lo_offset)) )
+        print("Gain:        %f dB" % (self._gain))
+        print("Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)))
+        print("Antenna:     %s"    % (self._ant))
+        print("Subdev Spec:  %s"   % (self._spec))
+        print("Clock Source: %s"    % (self._clock_source))
 
 #-------------------------------------------------------------------#
 #   RECEIVER
@@ -191,7 +193,7 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
         gr.hier_block2.__init__(self, "uhd_receiver",
                                 gr.io_signature(0,0,0),
                                 gr.io_signature(1,1,gr.sizeof_gr_complex))
-      
+
         # Set up the UHD interface as a receiver
         uhd_interface.__init__(self, False, args, sym_rate, sps,
                                freq, lo_offset, gain, spec, antenna, 
clock_source)
@@ -214,11 +216,11 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
                           help="set receive frequency to FREQ 
[default=%default]",
                           metavar="FREQ")
         parser.add_option("", "--lo-offset", type="eng_float", default=0,
-                          help="set local oscillator offset in Hz (default is 
0)") 
+                          help="set local oscillator offset in Hz (default is 
0)")
         parser.add_option("", "--rx-gain", type="eng_float", default=None,
                           help="set receive gain in dB (default is midpoint)")
         parser.add_option("-C", "--clock-source", type="string", default=None,
-                          help="select clock source (e.g. 'external') 
[default=%default]") 
+                          help="select clock source (e.g. 'external') 
[default=%default]")
         if not parser.has_option("--verbose"):
             parser.add_option("-v", "--verbose", action="store_true", 
default=False)
 
@@ -226,13 +228,13 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
         """
         Prints information about the UHD transmitter
         """
-        print "\nUHD Receiver:"
-        print "UHD Args:     %s"    % (self._args)
-        print "Freq:         %sHz"  % (eng_notation.num_to_str(self._freq))
-        print "LO Offset:    %sHz"  % 
(eng_notation.num_to_str(self._lo_offset)) 
-        print "Gain:         %f dB" % (self._gain)
-        print "Sample Rate:  %ssps" % (eng_notation.num_to_str(self._rate))
-        print "Antenna:      %s"    % (self._ant)
-        print "Spec:         %s"    % (self._spec)
-        print "Clock Source: %s"    % (self._clock_source) 
+        print("\nUHD Receiver:")
+        print("UHD Args:     %s"    % (self._args))
+        print("Freq:         %sHz"  % (eng_notation.num_to_str(self._freq)))
+        print("LO Offset:    %sHz"  % 
(eng_notation.num_to_str(self._lo_offset)) )
+        print("Gain:         %f dB" % (self._gain))
+        print("Sample Rate:  %ssps" % (eng_notation.num_to_str(self._rate)))
+        print("Antenna:      %s"    % (self._ant))
+        print("Spec:         %s"    % (self._spec))
+        print("Clock Source: %s"    % (self._clock_source))
 
diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py 
b/gr-digital/examples/ofdm/benchmark_add_channel.py
index 0ac4698..3c70978 100755
--- a/gr-digital/examples/ofdm/benchmark_add_channel.py
+++ b/gr-digital/examples/ofdm/benchmark_add_channel.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2010,2011 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 __future__ import print_function
 
 from gnuradio import gr, channels
 from gnuradio import blocks
@@ -40,7 +42,7 @@ class my_top_block(gr.top_block):
         power_in_signal = abs(options.tx_amplitude)**2
         noise_power = power_in_signal/SNR
         noise_voltage = math.sqrt(noise_power)
-        print "Noise voltage: ", noise_voltage
+        print("Noise voltage: ", noise_voltage)
 
         frequency_offset = options.frequency_offset / options.fft_length
 
@@ -54,7 +56,7 @@ class my_top_block(gr.top_block):
         self.snk = blocks.file_sink(gr.sizeof_gr_complex, ofile)
 
         self.connect(self.src, self.channel, self.phase, self.snk)
-        
+
 
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
@@ -94,13 +96,13 @@ def main():
 
     ifile = args[0]
     ofile = args[1]
-        
+
     # build the graph
     tb = my_top_block(ifile, ofile, options)
 
     r = gr.enable_realtime_scheduling()
     if r != gr.RT_OK:
-        print "Warning: Failed to enable realtime scheduling."
+        print("Warning: Failed to enable realtime scheduling.")
 
     tb.start()        # start flow graph
     tb.wait()         # wait for it to finish
diff --git a/gr-digital/examples/ofdm/transmit_path.py 
b/gr-digital/examples/ofdm/transmit_path.py
index 98a81f3..a8eece1 100644
--- a/gr-digital/examples/ofdm/transmit_path.py
+++ b/gr-digital/examples/ofdm/transmit_path.py
@@ -1,23 +1,25 @@
 #
 # Copyright 2005,2006,2011 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 __future__ import print_function
 
 from gnuradio import gr
 from gnuradio import eng_notation
@@ -31,15 +33,15 @@ import sys
 #                              transmit path
 # /////////////////////////////////////////////////////////////////////////////
 
-class transmit_path(gr.hier_block2): 
+class transmit_path(gr.hier_block2):
     def __init__(self, options):
         '''
         See below for what options should hold
         '''
 
-       gr.hier_block2.__init__(self, "transmit_path",
-                               gr.io_signature(0, 0, 0),
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex))
+        gr.hier_block2.__init__(self, "transmit_path",
+                                gr.io_signature(0, 0, 0),
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex))
 
         options = copy.copy(options)    # make a copy so we can destructively 
modify
 
@@ -63,13 +65,13 @@ class transmit_path(gr.hier_block2):
     def set_tx_amplitude(self, ampl):
         """
         Sets the transmit amplitude sent to the USRP
-        
+
         Args:
             : ampl 0 <= ampl < 1.0.  Try 0.10
         """
         self._tx_amplitude = max(0.0, min(ampl, 1))
         self.amp.set_k(self._tx_amplitude)
-        
+
     def send_pkt(self, payload='', eof=False):
         """
         Calls the transmitter method to send a packet
@@ -97,5 +99,5 @@ class transmit_path(gr.hier_block2):
         """
         Prints information about the transmit path
         """
-        print "Tx amplitude     %s" % (self._tx_amplitude)
-        
+        print("Tx amplitude     %s" % (self._tx_amplitude))
+
diff --git a/gr-digital/examples/ofdm/uhd_interface.py 
b/gr-digital/examples/ofdm/uhd_interface.py
index ac34d95..16ac13a 100644
--- a/gr-digital/examples/ofdm/uhd_interface.py
+++ b/gr-digital/examples/ofdm/uhd_interface.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2010,2011 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 __future__ import print_function
 
 from gnuradio import gr, uhd
 from gnuradio import eng_notation
@@ -44,14 +46,14 @@ def add_freq_option(parser):
 class uhd_interface:
     def __init__(self, istx, args, bandwidth, freq=None, lo_offset=None,
                  gain=None, spec=None, antenna=None, clock_source=None):
-        
+
         if(istx):
             self.u = uhd.usrp_sink(device_addr=args, 
stream_args=uhd.stream_args('fc32'))
         else:
             self.u = uhd.usrp_source(device_addr=args, 
stream_args=uhd.stream_args('fc32'))
 
         # Set clock source to external.
-        if(clock_source):        
+        if(clock_source):
             self.u.set_clock_source(clock_source, 0)
 
         # Set the subdevice spec
@@ -61,7 +63,7 @@ class uhd_interface:
         # Set the antenna
         if(antenna):
             self.u.set_antenna(antenna, 0)
-        
+
         self._args = args
         self._ant  = antenna
         self._spec = spec
@@ -74,21 +76,21 @@ class uhd_interface:
     def set_sample_rate(self, bandwidth):
         self.u.set_samp_rate(bandwidth)
         actual_bw = self.u.get_samp_rate()
-        
+
         return actual_bw
 
     def get_sample_rate(self):
         return self.u.get_samp_rate()
-    
+
     def set_gain(self, gain=None):
         if gain is None:
             # if no gain was specified, use the mid-point in dB
             g = self.u.get_gain_range()
             gain = float(g.start()+g.stop())/2
-            print "\nNo gain specified."
-            print "Setting gain to %f (from [%f, %f])" % \
-                (gain, g.start(), g.stop())
-        
+            print("\nNo gain specified.")
+            print("Setting gain to %f (from [%f, %f])" %
+                (gain, g.start(), g.stop()))
+
         self.u.set_gain(gain, 0)
         return gain
 
@@ -96,7 +98,7 @@ class uhd_interface:
         if(freq is None):
             sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
             sys.exit(1)
-        
+
         r = self.u.set_center_freq(uhd.tune_request(freq, lo_offset))
 
         if r:
@@ -151,15 +153,15 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
         """
         Prints information about the UHD transmitter
         """
-        print "\nUHD Transmitter:"
-        print "UHD Args:     %s"    % (self._args)
-        print "Freq:         %sHz"  % (eng_notation.num_to_str(self._freq))
-        print "LO Offset:    %sHz"  % 
(eng_notation.num_to_str(self._lo_offset))
-        print "Gain:         %f dB" % (self._gain)
-        print "Sample Rate:  %ssps" % (eng_notation.num_to_str(self._rate))
-        print "Antenna:      %s"    % (self._ant)
-        print "Subdev Sec:   %s"    % (self._spec)
-        print "Clock Source: %s"    % (self._clock_source)
+        print("\nUHD Transmitter:")
+        print("UHD Args:     %s"    % (self._args))
+        print("Freq:         %sHz"  % (eng_notation.num_to_str(self._freq)))
+        print("LO Offset:    %sHz"  % 
(eng_notation.num_to_str(self._lo_offset)))
+        print("Gain:         %f dB" % (self._gain))
+        print("Sample Rate:  %ssps" % (eng_notation.num_to_str(self._rate)))
+        print("Antenna:      %s"    % (self._ant))
+        print("Subdev Sec:   %s"    % (self._spec))
+        print("Clock Source: %s"    % (self._clock_source))
 
 
 
@@ -174,7 +176,7 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
         gr.hier_block2.__init__(self, "uhd_receiver",
                                 gr.io_signature(0,0,0),
                                 gr.io_signature(1,1,gr.sizeof_gr_complex))
-      
+
         # Set up the UHD interface as a receiver
         uhd_interface.__init__(self, False, args, bandwidth,
                                freq, lo_offset, gain, spec, antenna, 
clock_source)
@@ -209,13 +211,13 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
         """
         Prints information about the UHD transmitter
         """
-        print "\nUHD Receiver:"
-        print "UHD Args:     %s"    % (self._args)
-        print "Freq:         %sHz"  % (eng_notation.num_to_str(self._freq))
-        print "LO Offset:    %sHz"  % 
(eng_notation.num_to_str(self._lo_offset))
-        print "Gain:         %f dB" % (self._gain)
-        print "Sample Rate:  %ssps" % (eng_notation.num_to_str(self._rate))
-        print "Antenna:      %s"    % (self._ant)
-        print "Subdev Sec:   %s"    % (self._spec)
-        print "Clock Source: %s"    % (self._clock_source)
+        print("\nUHD Receiver:")
+        print("UHD Args:     %s"    % (self._args))
+        print("Freq:         %sHz"  % (eng_notation.num_to_str(self._freq)))
+        print("LO Offset:    %sHz"  % 
(eng_notation.num_to_str(self._lo_offset)))
+        print("Gain:         %f dB" % (self._gain))
+        print("Sample Rate:  %ssps" % (eng_notation.num_to_str(self._rate)))
+        print("Antenna:      %s"    % (self._ant))
+        print("Subdev Sec:   %s"    % (self._spec))
+        print("Clock Source: %s"    % (self._clock_source))
 
diff --git a/gr-digital/examples/run_length.py 
b/gr-digital/examples/run_length.py
index 5020655..5d62ee4 100755
--- a/gr-digital/examples/run_length.py
+++ b/gr-digital/examples/run_length.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2007 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 __future__ import print_function
 
 from optparse import OptionParser
 import sys
@@ -30,9 +32,9 @@ def main():
     (options, args) = parser.parse_args()
 
     if options.file == None:
-        print "Must specify file to read from using '-f'."
+        print("Must specify file to read from using '-f'.")
         sys.exit(1)
-    print "Using", options.file, "for data."
+    print("Using", options.file, "for data.")
 
     f = open(options.file, 'r')
     runs = []
@@ -40,7 +42,7 @@ def main():
     current = 0
     bytes = 0
     bits = 0
-    
+
     for ch in f.read():
         x = ord(ch)
         bytes = bytes + 1
@@ -66,18 +68,16 @@ def main():
     runs[count-1] = runs[count-1] + 1
 
     chk = 0
-    print "Bytes read: ", bytes
-    print "Bits read:  ", bits
-    print
+    print("Bytes read: ", bytes)
+    print("Bits read:  ", bits)
+    print()
     for i in range(len(runs)):
         chk = chk + runs[i]*(i+1)
-        print "Runs of length", i+1, ":", runs[i]
-    print
-    print "Sum of runs:", chk, "bits"
-    print
-    print "Maximum run length is", len(runs), "bits"
+        print("Runs of length", i+1, ":", runs[i])
+    print()
+    print("Sum of runs:", chk, "bits")
+    print()
+    print("Maximum run length is", len(runs), "bits")
 
 if __name__ == "__main__":
     main()
-
-    
diff --git a/gr-digital/examples/snr_estimators.py 
b/gr-digital/examples/snr_estimators.py
index 31efe6b..c6e787d 100755
--- a/gr-digital/examples/snr_estimators.py
+++ b/gr-digital/examples/snr_estimators.py
@@ -20,19 +20,21 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 import sys
 
 try:
     import scipy
     from scipy import stats
 except ImportError:
-    print "Error: Program requires scipy (www.scipy.org)."
+    print("Error: Program requires scipy (www.scipy.org).")
     sys.exit(1)
 
 try:
     import pylab
 except ImportError:
-    print "Error: Program requires Matplotlib (matplotlib.sourceforge.net)."
+    print("Error: Program requires Matplotlib (matplotlib.sourceforge.net).")
     sys.exit(1)
 
 from gnuradio import gr, digital, filter
@@ -158,7 +160,7 @@ def main():
         SNR = 10.0**(snr/10.0)
         scale = scipy.sqrt(2*SNR)
         yy = bits + n_cpx/scale
-        print "SNR: ", snr
+        print("SNR: ", snr)
 
         Sknown = scipy.mean(yy**2)
         Nknown = scipy.var(n_cpx/scale)
diff --git a/gr-digital/python/digital/cpm.py b/gr-digital/python/digital/cpm.py
index 322c3f0..6db597d 100644
--- a/gr-digital/python/digital/cpm.py
+++ b/gr-digital/python/digital/cpm.py
@@ -1,26 +1,28 @@
 #
-# CPM modulation and demodulation.  
+# CPM modulation and demodulation.
 #
 #
 # Copyright 2005-2007,2011 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 __future__ import print_function
 
 # See gnuradio-examples/python/digital for examples
 
@@ -53,16 +55,16 @@ _def_log = False
 class cpm_mod(gr.hier_block2):
     """
     Hierarchical block for Continuous Phase modulation.
-    
+
     The input is a byte stream (unsigned char) representing packed
     bits and the output is the complex modulated signal at baseband.
-    
+
     See Proakis for definition of generic CPM signals:
     s(t)=exp(j phi(t))
     phi(t)= 2 pi h int_0^t f(t') dt'
     f(t)=sum_k a_k g(t-kT)
     (normalizing assumption: int_0^infty g(t) dt = 1/2)
-    
+
     Args:
         samples_per_symbol: samples per baud >= 2 (integer)
         bits_per_symbol: bits per symbol (integer)
@@ -76,21 +78,21 @@ class cpm_mod(gr.hier_block2):
         debug: Print modulation data to files? (boolean)
     """
 
-    def __init__(self, 
+    def __init__(self,
                  samples_per_symbol=_def_samples_per_symbol,
                  bits_per_symbol=_def_bits_per_symbol,
                  h_numerator=_def_h_numerator,
                  h_denominator=_def_h_denominator,
                  cpm_type=_def_cpm_type,
-                bt=_def_bt,
-                symbols_per_pulse=_def_symbols_per_pulse,
+                 bt=_def_bt,
+                 symbols_per_pulse=_def_symbols_per_pulse,
                  generic_taps=_def_generic_taps,
                  verbose=_def_verbose,
                  log=_def_log):
 
-       gr.hier_block2.__init__(self, "cpm_mod", 
-                               gr.io_signature(1, 1, gr.sizeof_char),       # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex)) #  
Output signature
+        gr.hier_block2.__init__(self, "cpm_mod",
+                                gr.io_signature(1, 1, gr.sizeof_char),       # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
 Output signature
 
         self._samples_per_symbol = samples_per_symbol
         self._bits_per_symbol = bits_per_symbol
@@ -99,29 +101,29 @@ class cpm_mod(gr.hier_block2):
         self._cpm_type = cpm_type
         self._bt=bt
         if cpm_type == 0 or cpm_type == 2 or cpm_type == 3: # CPFSK, RC, 
Generic
-           self._symbols_per_pulse = symbols_per_pulse
+            self._symbols_per_pulse = symbols_per_pulse
         elif cpm_type == 1: # GMSK
-           self._symbols_per_pulse = 4
+            self._symbols_per_pulse = 4
         else:
-            raise TypeError, ("cpm_type must be an integer in {0,1,2,3}, is 
%r" % (cpm_type,))
+            raise TypeError("cpm_type must be an integer in {0,1,2,3}, is %r" 
% (cpm_type,))
 
         self._generic_taps=numpy.array(generic_taps)
 
         if samples_per_symbol < 2:
-            raise TypeError, ("samples_per_symbol must be >= 2, is %r" % 
(samples_per_symbol,))
+            raise TypeError("samples_per_symbol must be >= 2, is %r" % 
(samples_per_symbol,))
 
         self.nsymbols = 2**bits_per_symbol
         self.sym_alphabet = 
numpy.arange(-(self.nsymbols-1),self.nsymbols,2).tolist()
 
 
-       self.ntaps = int(self._symbols_per_pulse * samples_per_symbol)
-       sensitivity = 2 * pi * h_numerator / h_denominator / samples_per_symbol
+        self.ntaps = int(self._symbols_per_pulse * samples_per_symbol)
+        sensitivity = 2 * pi * h_numerator / h_denominator / samples_per_symbol
 
         # Unpack Bytes into bits_per_symbol groups
         self.B2s = 
blocks.packed_to_unpacked_bb(bits_per_symbol,gr.GR_MSB_FIRST)
- 
- 
-       # Turn it into symmetric PAM data.
+
+
+        # Turn it into symmetric PAM data.
         self.pam = digital_swig.chunks_to_symbols_bf(self.sym_alphabet,1)
 
         # Generate pulse (sum of taps = samples_per_symbol/2)
@@ -134,67 +136,67 @@ class cpm_mod(gr.hier_block2):
                 bt,                    # bandwidth * symbol time
                 self.ntaps                  # number of taps
                 )
-           sqwave = (1,) * samples_per_symbol       # rectangular window
-           self.taps = 
numpy.convolve(numpy.array(gaussian_taps),numpy.array(sqwave))
+            sqwave = (1,) * samples_per_symbol       # rectangular window
+            self.taps = 
numpy.convolve(numpy.array(gaussian_taps),numpy.array(sqwave))
         elif cpm_type == 2: # Raised Cosine
             # generalize it for arbitrary roll-off factor
             self.taps = 
(1-numpy.cos(2*pi*numpy.arange(0,self.ntaps)/samples_per_symbol/self._symbols_per_pulse))/(2*self._symbols_per_pulse)
         elif cpm_type == 3: # Generic CPM
             self.taps = generic_taps
         else:
-            raise TypeError, ("cpm_type must be an integer in {0,1,2,3}, is 
%r" % (cpm_type,))
+            raise TypeError("cpm_type must be an integer in {0,1,2,3}, is %r" 
% (cpm_type,))
 
         self.filter = filter.pfb.arb_resampler_fff(samples_per_symbol, 
self.taps)
 
-       # FM modulation
-       self.fmmod = analog.frequency_modulator_fc(sensitivity)
-               
+        # FM modulation
+        self.fmmod = analog.frequency_modulator_fc(sensitivity)
+
         if verbose:
             self._print_verbage()
-         
+
         if log:
             self._setup_logging()
 
-       # Connect
-       self.connect(self, self.B2s, self.pam, self.filter, self.fmmod, self)
+        # Connect
+        self.connect(self, self.B2s, self.pam, self.filter, self.fmmod, self)
 
     def samples_per_symbol(self):
         return self._samples_per_symbol
-    
-    def bits_per_symbol(self):  
+
+    def bits_per_symbol(self):
         return self._bits_per_symbol
-    
-    def h_numerator(self):  
+
+    def h_numerator(self):
         return self._h_numerator
 
-    def h_denominator(self):  
+    def h_denominator(self):
         return self._h_denominator
 
-    def cpm_type(self):  
+    def cpm_type(self):
         return self._cpm_type
 
-    def bt(self):  
+    def bt(self):
         return self._bt
 
-    def symbols_per_pulse(self):  
+    def symbols_per_pulse(self):
         return self._symbols_per_pulse
 
 
     def _print_verbage(self):
-        print "Samples per symbol = %d" % self._samples_per_symbol
-        print "Bits per symbol = %d" % self._bits_per_symbol
-        print "h = " , self._h_numerator , " / " ,  self._h_denominator
-        print "Symbol alphabet = " , self.sym_alphabet
-        print "Symbols per pulse = %d" % self._symbols_per_pulse
-        print "taps = " , self.taps
-
-        print "CPM type = %d" % self._cpm_type
+        print("Samples per symbol = %d" % self._samples_per_symbol)
+        print("Bits per symbol = %d" % self._bits_per_symbol)
+        print("h = " , self._h_numerator , " / " ,  self._h_denominator)
+        print("Symbol alphabet = " , self.sym_alphabet)
+        print("Symbols per pulse = %d" % self._symbols_per_pulse)
+        print("taps = " , self.taps)
+
+        print("CPM type = %d" % self._cpm_type)
         if self._cpm_type == 1:
-             print "Gaussian filter BT = %.2f" % self._bt
+             print("Gaussian filter BT = %.2f" % self._bt)
 
 
     def _setup_logging(self):
-        print "Modulation logging turned on."
+        print("Modulation logging turned on.")
         self.connect(self.B2s,
                      blocks.file_sink(gr.sizeof_float, "symbols.dat"))
         self.connect(self.pam,
diff --git a/gr-digital/python/digital/generic_mod_demod.py 
b/gr-digital/python/digital/generic_mod_demod.py
index 1b8e114..9069ba9 100644
--- a/gr-digital/python/digital/generic_mod_demod.py
+++ b/gr-digital/python/digital/generic_mod_demod.py
@@ -19,6 +19,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 # See gnuradio-examples/python/digital for examples
 
 """
@@ -113,9 +115,9 @@ class generic_mod(gr.hier_block2):
                  verbose=_def_verbose,
                  log=_def_log):
 
-       gr.hier_block2.__init__(self, "generic_mod",
-                               gr.io_signature(1, 1, gr.sizeof_char),       # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
+        gr.hier_block2.__init__(self, "generic_mod",
+                                gr.io_signature(1, 1, gr.sizeof_char),       # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
 
         self._constellation = constellation
         self._samples_per_symbol = samples_per_symbol
@@ -125,7 +127,7 @@ class generic_mod(gr.hier_block2):
         self.pre_diff_code = pre_diff_code and 
self._constellation.apply_pre_diff_code()
 
         if self._samples_per_symbol < 2:
-            raise TypeError, ("sps must be >= 2, is %f" % 
self._samples_per_symbol)
+            raise TypeError("sps must be >= 2, is %f" % 
self._samples_per_symbol)
 
         arity = pow(2,self.bits_per_symbol())
 
@@ -153,7 +155,7 @@ class generic_mod(gr.hier_block2):
         self.rrc_filter = 
filter.pfb_arb_resampler_ccf(self._samples_per_symbol,
                                                        self.rrc_taps)
 
-       # Connect
+        # Connect
         self._blocks = [self, self.bytes2chunks]
         if self.pre_diff_code:
             self._blocks.append(self.symbol_mapper)
@@ -191,12 +193,12 @@ class generic_mod(gr.hier_block2):
 
 
     def _print_verbage(self):
-        print "\nModulator:"
-        print "bits per symbol:     %d" % self.bits_per_symbol()
-        print "RRC roll-off factor: %.2f" % self._excess_bw
+        print("\nModulator:")
+        print("bits per symbol:     %d" % self.bits_per_symbol())
+        print("RRC roll-off factor: %.2f" % self._excess_bw)
 
     def _setup_logging(self):
-        print "Modulation logging turned on."
+        print("Modulation logging turned on.")
         self.connect(self.bytes2chunks,
                      blocks.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b"))
         if self.pre_diff_code:
@@ -249,9 +251,9 @@ class generic_demod(gr.hier_block2):
                  verbose=_def_verbose,
                  log=_def_log):
 
-       gr.hier_block2.__init__(self, "generic_demod",
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_char))       # 
Output signature
+        gr.hier_block2.__init__(self, "generic_demod",
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_char))       # 
Output signature
 
         self._constellation = constellation
         self._samples_per_symbol = samples_per_symbol
@@ -263,7 +265,7 @@ class generic_demod(gr.hier_block2):
         self._differential = differential
 
         if self._samples_per_symbol < 2:
-            raise TypeError, ("sps must be >= 2, is %d" % 
self._samples_per_symbol)
+            raise TypeError("sps must be >= 2, is %d" % 
self._samples_per_symbol)
 
         # Only apply a predifferential coding if the constellation also 
supports it.
         self.pre_diff_code = pre_diff_code and 
self._constellation.apply_pre_diff_code()
@@ -328,15 +330,15 @@ class generic_demod(gr.hier_block2):
         return self._constellation.bits_per_symbol()
 
     def _print_verbage(self):
-        print "\nDemodulator:"
-        print "bits per symbol:     %d"   % self.bits_per_symbol()
-        print "RRC roll-off factor: %.2f" % self._excess_bw
-        print "FLL bandwidth:       %.2e" % self._freq_bw
-        print "Timing bandwidth:    %.2e" % self._timing_bw
-        print "Phase bandwidth:     %.2e" % self._phase_bw
+        print("\nDemodulator:")
+        print("bits per symbol:     %d"   % self.bits_per_symbol())
+        print("RRC roll-off factor: %.2f" % self._excess_bw)
+        print("FLL bandwidth:       %.2e" % self._freq_bw)
+        print("Timing bandwidth:    %.2e" % self._timing_bw)
+        print("Phase bandwidth:     %.2e" % self._phase_bw)
 
     def _setup_logging(self):
-        print "Modulation logging turned on."
+        print("Modulation logging turned on.")
         self.connect(self.agc,
                      blocks.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc"))
         self.connect((self.freq_recov, 0),
diff --git a/gr-digital/python/digital/gfsk.py 
b/gr-digital/python/digital/gfsk.py
index 3569ffe..813f37d 100644
--- a/gr-digital/python/digital/gfsk.py
+++ b/gr-digital/python/digital/gfsk.py
@@ -1,26 +1,28 @@
 #
-# GFSK modulation and demodulation.  
+# GFSK modulation and demodulation.
 #
 #
 # Copyright 2005-2007,2012 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 __future__ import print_function
 
 # See gnuradio-examples/python/digital for examples
 
@@ -69,22 +71,22 @@ class gfsk_mod(gr.hier_block2):
                  verbose=_def_verbose,
                  log=_def_log):
         """
-       Hierarchical block for Gaussian Frequency Shift Key (GFSK)
-       modulation.
+        Hierarchical block for Gaussian Frequency Shift Key (GFSK)
+        modulation.
 
-       The input is a byte stream (unsigned char) and the
-       output is the complex modulated signal at baseband.
+        The input is a byte stream (unsigned char) and the
+        output is the complex modulated signal at baseband.
 
         Args:
             samples_per_symbol: samples per baud >= 2 (integer)
             bt: Gaussian filter bandwidth * symbol time (float)
             verbose: Print information about modulator? (bool)
             debug: Print modualtion data to files? (bool)
-       """
+        """
 
-       gr.hier_block2.__init__(self, "gfsk_mod",
-                               gr.io_signature(1, 1, gr.sizeof_char),       # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
+        gr.hier_block2.__init__(self, "gfsk_mod",
+                                gr.io_signature(1, 1, gr.sizeof_char),       # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
 
         samples_per_symbol = int(samples_per_symbol)
         self._samples_per_symbol = samples_per_symbol
@@ -92,43 +94,43 @@ class gfsk_mod(gr.hier_block2):
         self._differential = False
 
         if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2:
-            raise TypeError, ("samples_per_symbol must be an integer >= 2, is 
%r" % (samples_per_symbol,))
+            raise TypeError("samples_per_symbol must be an integer >= 2, is 
%r" % (samples_per_symbol,))
 
-       ntaps = 4 * samples_per_symbol                  # up to 3 bits in 
filter at once
-       #sensitivity = (pi / 2) / samples_per_symbol    # phase change per bit 
= pi / 2
+        ntaps = 4 * samples_per_symbol                 # up to 3 bits in 
filter at once
+        #sensitivity = (pi / 2) / samples_per_symbol   # phase change per bit 
= pi / 2
 
-       # Turn it into NRZ data.
-       #self.nrz = digital.bytes_to_syms()
+        # Turn it into NRZ data.
+        #self.nrz = digital.bytes_to_syms()
         self.unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
         self.nrz = digital.chunks_to_symbols_bf([-1, 1])
 
-       # Form Gaussian filter
+        # Form Gaussian filter
         # Generate Gaussian response (Needs to be convolved with window below).
-       self.gaussian_taps = filter.firdes.gaussian(
-               1.0,                   # gain
-               samples_per_symbol,    # symbol_rate
-               bt,                    # bandwidth * symbol time
-               ntaps                  # number of taps
-               )
-
-       self.sqwave = (1,) * samples_per_symbol       # rectangular window
-       self.taps = 
numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
-       self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, 
self.taps)
-
-       # FM modulation
-       self.fmmod = analog.frequency_modulator_fc(sensitivity)
-
-       # small amount of output attenuation to prevent clipping USRP sink
-       self.amp = blocks.multiply_const_cc(0.999)
-               
+        self.gaussian_taps = filter.firdes.gaussian(
+                1.0,                  # gain
+                samples_per_symbol,    # symbol_rate
+                bt,                   # bandwidth * symbol time
+                ntaps                  # number of taps
+                )
+
+        self.sqwave = (1,) * samples_per_symbol       # rectangular window
+        self.taps = 
numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
+        self.gaussian_filter = 
filter.interp_fir_filter_fff(samples_per_symbol, self.taps)
+
+        # FM modulation
+        self.fmmod = analog.frequency_modulator_fc(sensitivity)
+
+        # small amount of output attenuation to prevent clipping USRP sink
+        self.amp = blocks.multiply_const_cc(0.999)
+
         if verbose:
             self._print_verbage()
-         
+
         if log:
             self._setup_logging()
 
-       # Connect & Initialize base class
-       self.connect(self, self.unpack, self.nrz, self.gaussian_filter, 
self.fmmod, self.amp, self)
+        # Connect & Initialize base class
+        self.connect(self, self.unpack, self.nrz, self.gaussian_filter, 
self.fmmod, self.amp, self)
 
     def samples_per_symbol(self):
         return self._samples_per_symbol
@@ -138,12 +140,12 @@ class gfsk_mod(gr.hier_block2):
         return 1
 
     def _print_verbage(self):
-        print "bits per symbol = %d" % self.bits_per_symbol()
-        print "Gaussian filter bt = %.2f" % self._bt
+        print("bits per symbol = %d" % self.bits_per_symbol())
+        print("Gaussian filter bt = %.2f" % self._bt)
 
 
     def _setup_logging(self):
-        print "Modulation logging turned on."
+        print("Modulation logging turned on.")
         self.connect(self.nrz,
                      blocks.file_sink(gr.sizeof_float, "nrz.dat"))
         self.connect(self.gaussian_filter,
@@ -184,11 +186,11 @@ class gfsk_demod(gr.hier_block2):
                  verbose=_def_verbose,
                  log=_def_log):
         """
-       Hierarchical block for Gaussian Minimum Shift Key (GFSK)
-       demodulation.
+        Hierarchical block for Gaussian Minimum Shift Key (GFSK)
+        demodulation.
 
-       The input is the complex modulated signal at baseband.
-       The output is a stream of bits packed 1 bit per byte (the LSB)
+        The input is the complex modulated signal at baseband.
+        The output is a stream of bits packed 1 bit per byte (the LSB)
 
         Args:
             samples_per_symbol: samples per baud (integer)
@@ -196,18 +198,18 @@ class gfsk_demod(gr.hier_block2):
             log: Print modualtion data to files? (bool)
 
         Clock recovery parameters.  These all have reasonble defaults.
-        
+
         Args:
             gain_mu: controls rate of mu adjustment (float)
             mu: fractional delay [0.0, 1.0] (float)
             omega_relative_limit: sets max variation in omega (float, 
typically 0.000200 (200 ppm))
             freq_error: bit rate error as a fraction
-            float: 
-       """
+            float:
+        """
 
-       gr.hier_block2.__init__(self, "gfsk_demod",
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_char))       # 
Output signature
+        gr.hier_block2.__init__(self, "gfsk_demod",
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_char))       # 
Output signature
 
         self._samples_per_symbol = samples_per_symbol
         self._gain_mu = gain_mu
@@ -215,24 +217,24 @@ class gfsk_demod(gr.hier_block2):
         self._omega_relative_limit = omega_relative_limit
         self._freq_error = freq_error
         self._differential = False
-        
+
         if samples_per_symbol < 2:
-            raise TypeError, "samples_per_symbol >= 2, is %f" % 
samples_per_symbol
+            raise TypeError("samples_per_symbol >= 2, is %f" % 
samples_per_symbol)
 
         self._omega = samples_per_symbol*(1+self._freq_error)
 
         if not self._gain_mu:
             self._gain_mu = 0.175
-            
-       self._gain_omega = .25 * self._gain_mu * self._gain_mu        # 
critically damped
 
-       # Demodulate FM
-       #sensitivity = (pi / 2) / samples_per_symbol
-       self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
+        self._gain_omega = .25 * self._gain_mu * self._gain_mu        # 
critically damped
 
-       # the clock recovery block tracks the symbol clock and resamples as 
needed.
-       # the output of the block is a stream of soft symbols (float)
-       self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, 
self._gain_omega,
+        # Demodulate FM
+        #sensitivity = (pi / 2) / samples_per_symbol
+        self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
+
+        # the clock recovery block tracks the symbol clock and resamples as 
needed.
+        # the output of the block is a stream of soft symbols (float)
+        self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, 
self._gain_omega,
                                                            self._mu, 
self._gain_mu,
                                                            
self._omega_relative_limit)
 
@@ -241,12 +243,12 @@ class gfsk_demod(gr.hier_block2):
 
         if verbose:
             self._print_verbage()
-         
+
         if log:
             self._setup_logging()
 
-       # Connect & Initialize base class
-       self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self)
+        # Connect & Initialize base class
+        self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, 
self)
 
     def samples_per_symbol(self):
         return self._samples_per_symbol
@@ -256,16 +258,16 @@ class gfsk_demod(gr.hier_block2):
         return 1
 
     def _print_verbage(self):
-        print "bits per symbol = %d" % self.bits_per_symbol()
-        print "M&M clock recovery omega = %f" % self._omega
-        print "M&M clock recovery gain mu = %f" % self._gain_mu
-        print "M&M clock recovery mu = %f" % self._mu
-        print "M&M clock recovery omega rel. limit = %f" % 
self._omega_relative_limit
-        print "frequency error = %f" % self._freq_error
+        print("bits per symbol = %d" % self.bits_per_symbol())
+        print("M&M clock recovery omega = %f" % self._omega)
+        print("M&M clock recovery gain mu = %f" % self._gain_mu)
+        print("M&M clock recovery mu = %f" % self._mu)
+        print("M&M clock recovery omega rel. limit = %f" % 
self._omega_relative_limit)
+        print("frequency error = %f" % self._freq_error)
 
 
     def _setup_logging(self):
-        print "Demodulation logging turned on."
+        print("Demodulation logging turned on.")
         self.connect(self.fmdemod,
                     blocks.file_sink(gr.sizeof_float, "fmdemod.dat"))
         self.connect(self.clock_recovery,
diff --git a/gr-digital/python/digital/gmsk.py 
b/gr-digital/python/digital/gmsk.py
index e7a92a9..c22ecf1 100644
--- a/gr-digital/python/digital/gmsk.py
+++ b/gr-digital/python/digital/gmsk.py
@@ -1,26 +1,28 @@
 #
-# GMSK modulation and demodulation.  
+# GMSK modulation and demodulation.
 #
 #
 # Copyright 2005-2007,2012 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 __future__ import print_function
 
 # See gnuradio-examples/python/digital for examples
 
@@ -58,10 +60,10 @@ class gmsk_mod(gr.hier_block2):
     """
     Hierarchical block for Gaussian Minimum Shift Key (GMSK)
     modulation.
-    
+
     The input is a byte stream (unsigned char with packed bits)
     and the output is the complex modulated signal at baseband.
-    
+
     Args:
         samples_per_symbol: samples per baud >= 2 (integer)
         bt: Gaussian filter bandwidth * symbol time (float)
@@ -75,9 +77,9 @@ class gmsk_mod(gr.hier_block2):
                  verbose=_def_verbose,
                  log=_def_log):
 
-       gr.hier_block2.__init__(self, "gmsk_mod",
-                               gr.io_signature(1, 1, gr.sizeof_char),       # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
+        gr.hier_block2.__init__(self, "gmsk_mod",
+                                gr.io_signature(1, 1, gr.sizeof_char),       # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
 
         samples_per_symbol = int(samples_per_symbol)
         self._samples_per_symbol = samples_per_symbol
@@ -85,40 +87,40 @@ class gmsk_mod(gr.hier_block2):
         self._differential = False
 
         if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2:
-            raise TypeError, ("samples_per_symbol must be an integer >= 2, is 
%r" % (samples_per_symbol,))
+            raise TypeError("samples_per_symbol must be an integer >= 2, is 
%r" % (samples_per_symbol,))
 
-       ntaps = 4 * samples_per_symbol                  # up to 3 bits in 
filter at once
-       sensitivity = (pi / 2) / samples_per_symbol     # phase change per bit 
= pi / 2
+        ntaps = 4 * samples_per_symbol                        # up to 3 bits 
in filter at once
+        sensitivity = (pi / 2) / samples_per_symbol        # phase change per 
bit = pi / 2
 
-       # Turn it into NRZ data.
-       #self.nrz = digital.bytes_to_syms()
+        # Turn it into NRZ data.
+        #self.nrz = digital.bytes_to_syms()
         self.unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
         self.nrz = digital.chunks_to_symbols_bf([-1, 1], 1)
 
-       # Form Gaussian filter
+        # Form Gaussian filter
         # Generate Gaussian response (Needs to be convolved with window below).
-       self.gaussian_taps = filter.firdes.gaussian(
-               1,                     # gain
-               samples_per_symbol,    # symbol_rate
-               bt,                    # bandwidth * symbol time
-               ntaps                  # number of taps
-               )
-
-       self.sqwave = (1,) * samples_per_symbol       # rectangular window
-       self.taps = 
numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
-       self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, 
self.taps)
-
-       # FM modulation
-       self.fmmod = analog.frequency_modulator_fc(sensitivity)
-               
+        self.gaussian_taps = filter.firdes.gaussian(
+                1,                       # gain
+                samples_per_symbol,    # symbol_rate
+                bt,                       # bandwidth * symbol time
+                ntaps                       # number of taps
+                )
+
+        self.sqwave = (1,) * samples_per_symbol       # rectangular window
+        self.taps = 
numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
+        self.gaussian_filter = 
filter.interp_fir_filter_fff(samples_per_symbol, self.taps)
+
+        # FM modulation
+        self.fmmod = analog.frequency_modulator_fc(sensitivity)
+
         if verbose:
             self._print_verbage()
-         
+
         if log:
             self._setup_logging()
 
-       # Connect & Initialize base class
-       self.connect(self, self.unpack, self.nrz, self.gaussian_filter, 
self.fmmod, self)
+        # Connect & Initialize base class
+        self.connect(self, self.unpack, self.nrz, self.gaussian_filter, 
self.fmmod, self)
 
     def samples_per_symbol(self):
         return self._samples_per_symbol
@@ -128,12 +130,12 @@ class gmsk_mod(gr.hier_block2):
         return 1
 
     def _print_verbage(self):
-        print "bits per symbol = %d" % self.bits_per_symbol()
-        print "Gaussian filter bt = %.2f" % self._bt
+        print("bits per symbol = %d" % self.bits_per_symbol())
+        print("Gaussian filter bt = %.2f" % self._bt)
 
 
     def _setup_logging(self):
-        print "Modulation logging turned on."
+        print("Modulation logging turned on.")
         self.connect(self.nrz,
                      blocks.file_sink(gr.sizeof_float, "nrz.dat"))
         self.connect(self.gaussian_filter,
@@ -166,10 +168,10 @@ class gmsk_demod(gr.hier_block2):
     """
     Hierarchical block for Gaussian Minimum Shift Key (GMSK)
     demodulation.
-    
+
     The input is the complex modulated signal at baseband.
     The output is a stream of bits packed 1 bit per byte (the LSB)
-    
+
     Args:
         samples_per_symbol: samples per baud (integer)
         gain_mu: controls rate of mu adjustment (float)
@@ -179,7 +181,7 @@ class gmsk_demod(gr.hier_block2):
         verbose: Print information about modulator? (boolean)
         log: Print modualtion data to files? (boolean)
     """
-    
+
     def __init__(self,
                  samples_per_symbol=_def_samples_per_symbol,
                  gain_mu=_def_gain_mu,
@@ -189,9 +191,9 @@ class gmsk_demod(gr.hier_block2):
                  verbose=_def_verbose,
                  log=_def_log):
 
-       gr.hier_block2.__init__(self, "gmsk_demod",
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_char))       # 
Output signature
+        gr.hier_block2.__init__(self, "gmsk_demod",
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_char))       # 
Output signature
 
         self._samples_per_symbol = samples_per_symbol
         self._gain_mu = gain_mu
@@ -199,24 +201,24 @@ class gmsk_demod(gr.hier_block2):
         self._omega_relative_limit = omega_relative_limit
         self._freq_error = freq_error
         self._differential = False
-        
+
         if samples_per_symbol < 2:
-            raise TypeError, "samples_per_symbol >= 2, is %f" % 
samples_per_symbol
+            raise TypeError("samples_per_symbol >= 2, is %f" % 
samples_per_symbol)
 
         self._omega = samples_per_symbol*(1+self._freq_error)
 
         if not self._gain_mu:
             self._gain_mu = 0.175
-            
-       self._gain_omega = .25 * self._gain_mu * self._gain_mu        # 
critically damped
 
-       # Demodulate FM
-       sensitivity = (pi / 2) / samples_per_symbol
-       self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
+        self._gain_omega = .25 * self._gain_mu * self._gain_mu        # 
critically damped
 
-       # the clock recovery block tracks the symbol clock and resamples as 
needed.
-       # the output of the block is a stream of soft symbols (float)
-       self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, 
self._gain_omega,
+        # Demodulate FM
+        sensitivity = (pi / 2) / samples_per_symbol
+        self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
+
+        # the clock recovery block tracks the symbol clock and resamples as 
needed.
+        # the output of the block is a stream of soft symbols (float)
+        self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, 
self._gain_omega,
                                                            self._mu, 
self._gain_mu,
                                                            
self._omega_relative_limit)
 
@@ -225,12 +227,12 @@ class gmsk_demod(gr.hier_block2):
 
         if verbose:
             self._print_verbage()
-         
+
         if log:
             self._setup_logging()
 
-       # Connect & Initialize base class
-       self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self)
+        # Connect & Initialize base class
+        self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, 
self)
 
     def samples_per_symbol(self):
         return self._samples_per_symbol
@@ -240,16 +242,16 @@ class gmsk_demod(gr.hier_block2):
         return 1
 
     def _print_verbage(self):
-        print "bits per symbol = %d" % self.bits_per_symbol()
-        print "M&M clock recovery omega = %f" % self._omega
-        print "M&M clock recovery gain mu = %f" % self._gain_mu
-        print "M&M clock recovery mu = %f" % self._mu
-        print "M&M clock recovery omega rel. limit = %f" % 
self._omega_relative_limit
-        print "frequency error = %f" % self._freq_error
+        print("bits per symbol = %d" % self.bits_per_symbol())
+        print("M&M clock recovery omega = %f" % self._omega)
+        print("M&M clock recovery gain mu = %f" % self._gain_mu)
+        print("M&M clock recovery mu = %f" % self._mu)
+        print("M&M clock recovery omega rel. limit = %f" % 
self._omega_relative_limit)
+        print("frequency error = %f" % self._freq_error)
 
 
     def _setup_logging(self):
-        print "Demodulation logging turned on."
+        print("Demodulation logging turned on.")
         self.connect(self.fmdemod,
                     blocks.file_sink(gr.sizeof_float, "fmdemod.dat"))
         self.connect(self.clock_recovery,
diff --git a/gr-digital/python/digital/ofdm.py 
b/gr-digital/python/digital/ofdm.py
index 563b70a..42ab90d 100644
--- a/gr-digital/python/digital/ofdm.py
+++ b/gr-digital/python/digital/ofdm.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2006-2008,2013 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 __future__ import print_function
 
 import math
 from gnuradio import gr, fft
@@ -37,12 +39,12 @@ class ofdm_mod(gr.hier_block2):
     """
     Modulates an OFDM stream. Based on the options fft_length, occupied_tones, 
and
     cp_length, this block creates OFDM symbols using a specified modulation 
option.
-    
+
     Send packets by calling send_pkt
     """
     def __init__(self, options, msgq_limit=2, pad_for_usrp=True):
         """
-       Hierarchical block for sending packets
+        Hierarchical block for sending packets
 
         Packets to be sent are enqueued by calling send_pkt.
         The output is the complex modulated signal at baseband.
@@ -53,9 +55,9 @@ class ofdm_mod(gr.hier_block2):
             pad_for_usrp: If true, packets are padded such that they end up a 
multiple of 128 samples
         """
 
-       gr.hier_block2.__init__(self, "ofdm_mod",
-                               gr.io_signature(0, 0, 0),       # Input 
signature
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
+        gr.hier_block2.__init__(self, "ofdm_mod",
+                                gr.io_signature(0, 0, 0),       # Input 
signature
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
 
         self._pad_for_usrp = pad_for_usrp
         self._modulation = options.modulation
@@ -74,22 +76,22 @@ class ofdm_mod(gr.hier_block2):
 
         # hard-coded known symbols
         preambles = (ksfreq,)
-                
+
         padded_preambles = list()
         for pre in preambles:
             padded = self._fft_length*[0,]
             padded[zeros_on_left : zeros_on_left + self._occupied_tones] = pre
             padded_preambles.append(padded)
-            
+
         symbol_length = options.fft_length + options.cp_length
-        
+
         mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, 
"qam64": 64, "qam256": 256}
         arity = mods[self._modulation]
-        
+
         rot = 1
         if self._modulation == "qpsk":
             rot = (0.707+0.707j)
-            
+
         # FIXME: pass the constellation objects instead of just the points
         if(self._modulation.find("psk") >= 0):
             constel = psk.psk_constellation(arity)
@@ -97,23 +99,23 @@ class ofdm_mod(gr.hier_block2):
         elif(self._modulation.find("qam") >= 0):
             constel = qam.qam_constellation(arity)
             rotated_const = map(lambda pt: pt * rot, constel.points())
-        #print rotated_const
+        #print(rotated_const)
         self._pkt_input = digital.ofdm_mapper_bcv(rotated_const,
                                                   msgq_limit,
                                                   options.occupied_tones,
                                                   options.fft_length)
-        
+
         self.preambles = digital.ofdm_insert_preamble(self._fft_length,
                                                       padded_preambles)
         self.ifft = fft.fft_vcc(self._fft_length, False, win, True)
         self.cp_adder = digital.ofdm_cyclic_prefixer(self._fft_length,
                                                      symbol_length)
         self.scale = blocks.multiply_const_cc(1.0 / 
math.sqrt(self._fft_length))
-        
+
         self.connect((self._pkt_input, 0), (self.preambles, 0))
         self.connect((self._pkt_input, 1), (self.preambles, 1))
         self.connect(self.preambles, self.ifft, self.cp_adder, self.scale, 
self)
-        
+
         if options.verbose:
             self._print_verbage()
 
@@ -137,12 +139,12 @@ class ofdm_mod(gr.hier_block2):
         if eof:
             msg = gr.message(1) # tell self._pkt_input we're not sending any 
more packets
         else:
-            # print "original_payload =", string_to_hex_list(payload)
+            # print("original_payload =", string_to_hex_list(payload))
             pkt = ofdm_packet_utils.make_packet(payload, 1, 1,
                                                 self._pad_for_usrp,
                                                 whitening=True)
-            
-            #print "pkt =", string_to_hex_list(pkt)
+
+            #print("pkt =", string_to_hex_list(pkt))
             msg = gr.message_from_string(pkt)
         self._pkt_input.msgq().insert_tail(msg)
 
@@ -164,11 +166,11 @@ class ofdm_mod(gr.hier_block2):
         """
         Prints information about the OFDM modulator
         """
-        print "\nOFDM Modulator:"
-        print "Modulation Type: %s"    % (self._modulation)
-        print "FFT length:      %3d"   % (self._fft_length)
-        print "Occupied Tones:  %3d"   % (self._occupied_tones)
-        print "CP length:       %3d"   % (self._cp_length)
+        print("\nOFDM Modulator:")
+        print("Modulation Type: %s"    % (self._modulation))
+        print("FFT length:      %3d"   % (self._fft_length))
+        print("Occupied Tones:  %3d"   % (self._occupied_tones))
+        print("CP length:       %3d"   % (self._cp_length))
 
 
 class ofdm_demod(gr.hier_block2):
@@ -183,18 +185,18 @@ class ofdm_demod(gr.hier_block2):
 
     def __init__(self, options, callback=None):
         """
-       Hierarchical block for demodulating and deframing packets.
+        Hierarchical block for demodulating and deframing packets.
 
-       The input is the complex modulated signal at baseband.
+        The input is the complex modulated signal at baseband.
         Demodulated packets are sent to the handler.
 
         Args:
             options: pass modulation options from higher layers (fft length, 
occupied tones, etc.)
             callback: function of two args: ok, payload (ok: bool; payload: 
string)
-       """
-       gr.hier_block2.__init__(self, "ofdm_demod",
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
+        """
+        gr.hier_block2.__init__(self, "ofdm_demod",
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
 
 
         self._rcvd_pktq = gr.msg_queue()          # holds packets from the PHY
@@ -224,7 +226,7 @@ class ofdm_demod(gr.hier_block2):
 
         mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, 
"qam64": 64, "qam256": 256}
         arity = mods[self._modulation]
-        
+
         rot = 1
         if self._modulation == "qpsk":
             rot = (0.707+0.707j)
@@ -236,7 +238,7 @@ class ofdm_demod(gr.hier_block2):
         elif(self._modulation.find("qam") >= 0):
             constel = qam.qam_constellation(arity)
             rotated_const = map(lambda pt: pt * rot, constel.points())
-        #print rotated_const
+        #print(rotated_const)
 
         phgain = 0.25
         frgain = phgain*phgain / 4.0
@@ -263,7 +265,7 @@ class ofdm_demod(gr.hier_block2):
 
         if options.verbose:
             self._print_verbage()
-            
+
         self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
 
     @staticmethod
@@ -286,11 +288,11 @@ class ofdm_demod(gr.hier_block2):
         """
         Prints information about the OFDM demodulator
         """
-        print "\nOFDM Demodulator:"
-        print "Modulation Type: %s"    % (self._modulation)
-        print "FFT length:      %3d"   % (self._fft_length)
-        print "Occupied Tones:  %3d"   % (self._occupied_tones)
-        print "CP length:       %3d"   % (self._cp_length)
+        print("\nOFDM Demodulator:")
+        print("Modulation Type: %s"    % (self._modulation))
+        print("FFT length:      %3d"   % (self._fft_length))
+        print("Occupied Tones:  %3d"   % (self._occupied_tones))
+        print("CP length:       %3d"   % (self._cp_length))
 
 
 
diff --git a/gr-digital/python/digital/ofdm_packet_utils.py 
b/gr-digital/python/digital/ofdm_packet_utils.py
index e9ca641..4e354b7 100644
--- a/gr-digital/python/digital/ofdm_packet_utils.py
+++ b/gr-digital/python/digital/ofdm_packet_utils.py
@@ -19,6 +19,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 import struct
 import numpy
 from gnuradio import gru
@@ -46,7 +48,7 @@ def conv_1_0_string_to_packed_binary_string(s):
     to get to a multiple of 8.
     """
     if not is_1_0_string(s):
-        raise ValueError, "Input must be a string containing only 0's and 1's"
+        raise ValueError("Input must be a string containing only 0's and 1's")
 
     # pad to multiple of 8
     padded = False
@@ -93,7 +95,7 @@ def dewhiten(s, o):
 def make_header(payload_len, whitener_offset=0):
     # Upper nibble is offset, lower 12 bits is len
     val = ((whitener_offset & 0xf) << 12) | (payload_len & 0x0fff)
-    #print "offset =", whitener_offset, " len =", payload_len, " val=", val
+    #print("offset =", whitener_offset, " len =", payload_len, " val=", val)
     return struct.pack('!HH', val, val)
 
 def make_packet(payload, samples_per_symbol, bits_per_symbol,
@@ -113,15 +115,15 @@ def make_packet(payload, samples_per_symbol, 
bits_per_symbol,
     """
 
     if not whitener_offset >=0 and whitener_offset < 16:
-        raise ValueError, "whitener_offset must be between 0 and 15, inclusive 
(%i)" % (whitener_offset,)
+        raise ValueError("whitener_offset must be between 0 and 15, inclusive 
(%i)" % (whitener_offset,))
 
     payload_with_crc = crc.gen_and_append_crc32(payload)
-    #print "outbound crc =", string_to_hex_list(payload_with_crc[-4:])
+    #print("outbound crc =", string_to_hex_list(payload_with_crc[-4:]))
 
     L = len(payload_with_crc)
     MAXLEN = len(random_mask_tuple)
     if L > MAXLEN:
-        raise ValueError, "len(payload) must be in [0, %d]" % (MAXLEN,)
+        raise ValueError("len(payload) must be in [0, %d]" % (MAXLEN,))
 
     pkt_hd = make_header(L, whitener_offset)
     pkt_dt = ''.join((payload_with_crc, '\x55'))
@@ -136,7 +138,7 @@ def make_packet(payload, samples_per_symbol, 
bits_per_symbol,
     else:
         pkt = pkt_hd + pkt_dt
 
-    #print "make_packet: len(pkt) =", len(pkt)
+    #print("make_packet: len(pkt) =", len(pkt))
 
     return pkt
 
@@ -182,9 +184,9 @@ def unmake_packet(whitened_payload_with_crc, 
whitener_offset=0, dewhitening=1):
     ok, payload = crc.check_crc32(payload_with_crc)
 
     if 0:
-        print "payload_with_crc =", string_to_hex_list(payload_with_crc)
-        print "ok = %r, len(payload) = %d" % (ok, len(payload))
-        print "payload =", string_to_hex_list(payload)
+        print("payload_with_crc =", string_to_hex_list(payload_with_crc))
+        print("ok = %r, len(payload) = %d" % (ok, len(payload)))
+        print("payload =", string_to_hex_list(payload))
 
     return ok, payload
 
diff --git a/gr-digital/python/digital/ofdm_receiver.py 
b/gr-digital/python/digital/ofdm_receiver.py
index 4b7836b..27f8d4d 100644
--- a/gr-digital/python/digital/ofdm_receiver.py
+++ b/gr-digital/python/digital/ofdm_receiver.py
@@ -1,24 +1,24 @@
 #!/usr/bin/env python
 #
 # Copyright 2006-2008 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.
-# 
+#
 
 import math
 from numpy import fft
@@ -51,9 +51,9 @@ class ofdm_receiver(gr.hier_block2):
 
     def __init__(self, fft_length, cp_length, occupied_tones, snr, ks, 
logging=False):
         """
-       Hierarchical block for receiving OFDM symbols.
+        Hierarchical block for receiving OFDM symbols.
 
-       The input is the complex modulated signal at baseband.
+        The input is the complex modulated signal at baseband.
         Synchronized packets are sent back to the demodulator.
 
         Args:
@@ -63,12 +63,12 @@ class ofdm_receiver(gr.hier_block2):
             snr: estimated signal to noise ratio used to guide cyclic prefix 
synchronizer (float)
             ks: known symbols used as preambles to each packet (list of lists)
             logging: turn file logging on or off (bool)
-       """
+        """
 
-       gr.hier_block2.__init__(self, "ofdm_receiver",
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
+        gr.hier_block2.__init__(self, "ofdm_receiver",
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
                                 gr.io_signature2(2, 2, 
gr.sizeof_gr_complex*occupied_tones, gr.sizeof_char)) # Output signature
-        
+
         bw = (float(occupied_tones) / float(fft_length)) / 2.0
         tb = bw*0.08
         chan_coeffs = filter.firdes.low_pass (1.0,                     # gain
@@ -77,13 +77,13 @@ class ofdm_receiver(gr.hier_block2):
                                               tb,                      # width 
of trans. band
                                               filter.firdes.WIN_HAMMING)   # 
filter type
         self.chan_filt = filter.fft_filter_ccc(1, chan_coeffs)
-        
+
         win = [1 for i in range(fft_length)]
 
         zeros_on_left = int(math.ceil((fft_length - occupied_tones)/2.0))
         ks0 = fft_length*[0,]
         ks0[zeros_on_left : zeros_on_left + occupied_tones] = ks[0]
-        
+
         ks0 = fft.ifftshift(ks0)
         ks0time = fft.ifft(ks0)
         # ADD SCALING FACTOR
@@ -111,7 +111,7 @@ class ofdm_receiver(gr.hier_block2):
         # for testing only; do not user over the air
         # remove filter and filter delay for this
         elif SYNC == "fixed":
-            self.chan_filt = blocks.multiply_const_cc(1.0) 
+            self.chan_filt = blocks.multiply_const_cc(1.0)
             nsymbols = 18      # enter the number of symbols per packet
             freq_offset = 0.0  # if you use a frequency offset, enter it here
             nco_sensitivity = -2.0/fft_length   # correct for fine frequency
diff --git a/gr-digital/python/digital/ofdm_sync_ml.py 
b/gr-digital/python/digital/ofdm_sync_ml.py
index 3afd647..233d061 100644
--- a/gr-digital/python/digital/ofdm_sync_ml.py
+++ b/gr-digital/python/digital/ofdm_sync_ml.py
@@ -1,26 +1,25 @@
 #!/usr/bin/env python
 #
 # Copyright 2007,2008 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.
-# 
+#
 
-import math
 from gnuradio import gr
 
 try:
@@ -41,8 +40,8 @@ class ofdm_sync_ml(gr.hier_block2):
         Signal Processing, vol. 45, no. 7, pp. 1800-1805, 1997.
         '''
 
-       gr.hier_block2.__init__(self, "ofdm_sync_ml",
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
+        gr.hier_block2.__init__(self, "ofdm_sync_ml",
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
                                 gr.io_signature2(2, 2, gr.sizeof_float, 
gr.sizeof_char)) # Output signature
 
         self.input = blocks.add_const_cc(0)
@@ -68,13 +67,13 @@ class ofdm_sync_ml(gr.hier_block2):
 
         moving_sum_taps = [rho/2 for i in range(cp_length)]
         self.moving_sum_filter = filter.fir_filter_fff(1,moving_sum_taps)
-        
+
         self.connect(self.input,self.magsqrd1)
         self.connect(self.delay,self.magsqrd2)
         self.connect(self.magsqrd1,(self.adder,0))
         self.connect(self.magsqrd2,(self.adder,1))
         self.connect(self.adder,self.moving_sum_filter)
-        
+
 
         # Correlation from ML Sync
         self.conjg = blocks.conjugate_cc();
@@ -82,7 +81,7 @@ class ofdm_sync_ml(gr.hier_block2):
 
         movingsum2_taps = [1.0 for i in range(cp_length)]
         self.movingsum2 = filter.fir_filter_ccf(1,movingsum2_taps)
-        
+
         # Correlator data handler
         self.c2mag = blocks.complex_to_mag()
         self.angle = blocks.complex_to_arg()
@@ -104,7 +103,7 @@ class ofdm_sync_ml(gr.hier_block2):
         # use the sync loop values to set the sampler and the NCO
         #     self.diff = theta
         #     self.angle = epsilon
-                          
+
         self.connect(self.diff, self.pk_detect)
 
         # The DPLL corrects for timing differences between CP correlations
@@ -115,7 +114,7 @@ class ofdm_sync_ml(gr.hier_block2):
             self.connect(self.dpll, (self.sample_and_hold,1))
         else:
             self.connect(self.pk_detect, (self.sample_and_hold,1))
-            
+
         self.connect(self.angle, (self.sample_and_hold,0))
 
         ################################
@@ -130,7 +129,7 @@ class ofdm_sync_ml(gr.hier_block2):
         self.div = blocks.divide_ff()
 
         # The output signature of the correlation has a few spikes because the 
rest of the
-        # system uses the repeated preamble symbol. It needs to work that 
generically if 
+        # system uses the repeated preamble symbol. It needs to work that 
generically if
         # anyone wants to use this against a WiMAX-like signal since it, too, 
repeats.
         # The output theta of the correlator above is multiplied with this 
correlation to
         # identify the proper peak and remove other products in this 
cross-correlation
@@ -139,17 +138,17 @@ class ofdm_sync_ml(gr.hier_block2):
         self.f2b = blocks.float_to_char()
         self.b2f = blocks.char_to_float()
         self.mul = blocks.multiply_ff()
-        
+
         # Normalize the power of the corr output by the energy. This is not 
really needed
         # and could be removed for performance, but it makes for a cleaner 
signal.
         # if this is removed, the threshold value needs adjustment.
         self.connect(self.input, self.kscorr, self.corrmag, (self.div,0))
         self.connect(self.moving_sum_filter, (self.div,1))
-        
+
         self.connect(self.div, (self.mul,0))
         self.connect(self.pk_detect, self.b2f, (self.mul,1))
         self.connect(self.mul, self.slice)
-        
+
         # Set output signals
         #    Output 0: fine frequency correction value
         #    Output 1: timing signal
diff --git a/gr-digital/python/digital/ofdm_txrx.py 
b/gr-digital/python/digital/ofdm_txrx.py
index 6f96fc6..026f2bd 100644
--- a/gr-digital/python/digital/ofdm_txrx.py
+++ b/gr-digital/python/digital/ofdm_txrx.py
@@ -25,6 +25,8 @@ For simple configurations, no need to connect all the 
relevant OFDM blocks
 to form an OFDM Tx/Rx--simply use these.
 """
 
+from __future__ import print_function
+
 # Reminder: All frequency-domain stuff is in shifted form, i.e. DC carrier
 # in the middle!
 
@@ -112,7 +114,7 @@ def _get_constellation(bps):
     try:
         return constellation[bps]
     except KeyError:
-        print 'Modulation not supported.'
+        print('Modulation not supported.')
         exit(1)
 
 class ofdm_tx(gr.hier_block2):
diff --git a/gr-digital/python/digital/packet_utils.py 
b/gr-digital/python/digital/packet_utils.py
index de7e298..2a6859b 100644
--- a/gr-digital/python/digital/packet_utils.py
+++ b/gr-digital/python/digital/packet_utils.py
@@ -19,6 +19,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 import struct
 import numpy
 from gnuradio import gru
@@ -46,7 +48,7 @@ def conv_1_0_string_to_packed_binary_string(s):
     to get to a multiple of 8.
     """
     if not is_1_0_string(s):
-        raise ValueError, "Input must be a string containing only 0's and 1's"
+        raise ValueError("Input must be a string containing only 0's and 1's")
 
     # pad to multiple of 8
     padded = False
@@ -98,7 +100,7 @@ def dewhiten(s, o):
 def make_header(payload_len, whitener_offset=0):
     # Upper nibble is offset, lower 12 bits is len
     val = ((whitener_offset & 0xf) << 12) | (payload_len & 0x0fff)
-    #print "offset =", whitener_offset, " len =", payload_len, " val=", val
+    #print("offset =", whitener_offset, " len =", payload_len, " val=", val)
     return struct.pack('!HH', val, val)
 
 def make_packet(payload, samples_per_symbol, bits_per_symbol,
@@ -123,13 +125,13 @@ def make_packet(payload, samples_per_symbol, 
bits_per_symbol,
     and finally CRC-32.
     """
     if not is_1_0_string(preamble):
-        raise ValueError, "preamble must be a string containing only 0's and 
1's (%r)" % (preamble,)
+        raise ValueError("preamble must be a string containing only 0's and 
1's (%r)" % (preamble,))
 
     if not is_1_0_string(access_code):
-        raise ValueError, "access_code must be a string containing only 0's 
and 1's (%r)" % (access_code,)
+        raise ValueError("access_code must be a string containing only 0's and 
1's (%r)" % (access_code,))
 
     if not whitener_offset >=0 and whitener_offset < 16:
-        raise ValueError, "whitener_offset must be between 0 and 15, inclusive 
(%i)" % (whitener_offset,)
+        raise ValueError("whitener_offset must be between 0 and 15, inclusive 
(%i)" % (whitener_offset,))
 
     (packed_access_code, padded) = 
conv_1_0_string_to_packed_binary_string(access_code)
     (packed_preamble, ignore) = 
conv_1_0_string_to_packed_binary_string(preamble)
@@ -138,12 +140,12 @@ def make_packet(payload, samples_per_symbol, 
bits_per_symbol,
         payload_with_crc = crc.gen_and_append_crc32(payload)
     else:
         payload_with_crc = payload
-    #print "outbound crc =", string_to_hex_list(payload_with_crc[-4:])
+    #print("outbound crc =", string_to_hex_list(payload_with_crc[-4:]))
 
     L = len(payload_with_crc)
     MAXLEN = len(random_mask_tuple)
     if L > MAXLEN:
-        raise ValueError, "len(payload) must be in [0, %d]" % (MAXLEN,)
+        raise ValueError("len(payload) must be in [0, %d]" % (MAXLEN,))
 
     if whitening:
         pkt = ''.join((packed_preamble, packed_access_code, make_header(L, 
whitener_offset),
@@ -155,7 +157,7 @@ def make_packet(payload, samples_per_symbol, 
bits_per_symbol,
     if pad_for_usrp:
         pkt = pkt + (_npadding_bytes(len(pkt), int(samples_per_symbol), 
bits_per_symbol) * '\x55')
 
-    #print "make_packet: len(pkt) =", len(pkt)
+    #print("make_packet: len(pkt) =", len(pkt))
     return pkt
 
 def _npadding_bytes(pkt_byte_len, samples_per_symbol, bits_per_symbol):
@@ -206,10 +208,10 @@ def unmake_packet(whitened_payload_with_crc, 
whitener_offset=0,
         ok = True
 
     if 0:
-        print "payload_with_crc =", string_to_hex_list(payload_with_crc)
-        print "ok = %r, len(payload) = %d" % (ok, len(payload))
-        print "payload =", string_to_hex_list(payload)
-        print ""
+        print("payload_with_crc =", string_to_hex_list(payload_with_crc))
+        print("ok = %r, len(payload) = %d" % (ok, len(payload)))
+        print("payload =", string_to_hex_list(payload))
+        print("")
 
     return ok, payload
 
diff --git a/gr-digital/python/digital/pkt.py b/gr-digital/python/digital/pkt.py
index fbdcaa3..843b43f 100644
--- a/gr-digital/python/digital/pkt.py
+++ b/gr-digital/python/digital/pkt.py
@@ -1,23 +1,25 @@
 #
 # Copyright 2005, 2006, 2007 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 __future__ import print_function
 
 from math import pi
 from gnuradio import gr
@@ -43,7 +45,7 @@ class mod_pkts(gr.hier_block2):
     def __init__(self, modulator, preamble=None, access_code=None, 
msgq_limit=2,
                  pad_for_usrp=True, use_whitener_offset=False, modulate=True):
         """
-       Hierarchical block for sending packets
+        Hierarchical block for sending packets
 
         Packets to be sent are enqueued by calling send_pkt.
         The output is the complex modulated signal at baseband.
@@ -54,29 +56,29 @@ class mod_pkts(gr.hier_block2):
             msgq_limit: maximum number of messages in message queue (int)
             pad_for_usrp: If true, packets are padded such that they end up a 
multiple of 128 samples
             use_whitener_offset: If true, start of whitener XOR string is 
incremented each packet
-        
+
         See gmsk_mod for remaining parameters
         """
 
-       gr.hier_block2.__init__(self, "mod_pkts",
-                               gr.io_signature(0, 0, 0),                    # 
Input signature
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
+        gr.hier_block2.__init__(self, "mod_pkts",
+                                gr.io_signature(0, 0, 0),                    # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
 
         self._modulator = modulator
         self._pad_for_usrp = pad_for_usrp
         self._use_whitener_offset = use_whitener_offset
         self._whitener_offset = 0
-        
+
         if access_code is None:
             access_code = packet_utils.default_access_code
         if not packet_utils.is_1_0_string(access_code):
-            raise ValueError, "Invalid access_code %r. Must be string of 1's 
and 0's" % (access_code,)
+            raise ValueError("Invalid access_code %r. Must be string of 1's 
and 0's" % (access_code,))
         self._access_code = access_code
-        
+
         if preamble is None:
             preamble = packet_utils.default_preamble
         if not packet_utils.is_1_0_string(preamble):
-            raise ValueError, "Invalid preamble %r. Must be string of 1's and 
0's" % (preamble,)
+            raise ValueError("Invalid preamble %r. Must be string of 1's and 
0's" % (preamble,))
         self._preamble = preamble
 
         # accepts messages from the outside world
@@ -93,7 +95,7 @@ class mod_pkts(gr.hier_block2):
         if eof:
             msg = gr.message(1) # tell self._pkt_input we're not sending any 
more packets
         else:
-            # print "original_payload =", string_to_hex_list(payload)
+            # print("original_payload =", string_to_hex_list(payload))
             pkt = packet_utils.make_packet(payload,
                                            
self._modulator.samples_per_symbol(),
                                            self._modulator.bits_per_symbol(),
@@ -101,11 +103,11 @@ class mod_pkts(gr.hier_block2):
                                            self._access_code,
                                            self._pad_for_usrp,
                                            self._whitener_offset)
-            #print "pkt =", string_to_hex_list(pkt)
+            #print("pkt =", string_to_hex_list(pkt))
             msg = gr.message_from_string(pkt)
             if self._use_whitener_offset is True:
                 self._whitener_offset = (self._whitener_offset + 1) % 16
-                
+
         self._pkt_input.msgq().insert_tail(msg)
 
 
@@ -120,9 +122,9 @@ class demod_pkts(gr.hier_block2):
 
     def __init__(self, demodulator, access_code=None, callback=None, 
threshold=-1):
         """
-       Hierarchical block for demodulating and deframing packets.
+        Hierarchical block for demodulating and deframing packets.
 
-       The input is the complex modulated signal at baseband.
+        The input is the complex modulated signal at baseband.
         Demodulated packets are sent to the handler.
 
         Args:
@@ -130,17 +132,17 @@ class demod_pkts(gr.hier_block2):
             access_code: AKA sync vector (string of 1's and 0's)
             callback: function of two args: ok, payload (ok: bool; payload: 
string)
             threshold: detect access_code with up to threshold bits wrong (-1 
-> use default) (int)
-       """
+        """
 
-       gr.hier_block2.__init__(self, "demod_pkts",
-                               gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
-                               gr.io_signature(0, 0, 0))                    # 
Output signature
+        gr.hier_block2.__init__(self, "demod_pkts",
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
+                                gr.io_signature(0, 0, 0))                    # 
Output signature
 
         self._demodulator = demodulator
         if access_code is None:
             access_code = packet_utils.default_access_code
         if not packet_utils.is_1_0_string(access_code):
-            raise ValueError, "Invalid access_code %r. Must be string of 1's 
and 0's" % (access_code,)
+            raise ValueError("Invalid access_code %r. Must be string of 1's 
and 0's" % (access_code,))
         self._access_code = access_code
 
         if threshold == -1:
@@ -151,7 +153,7 @@ class demod_pkts(gr.hier_block2):
 
         self.framer_sink = digital.framer_sink_1(self._rcvd_pktq)
         self.connect(self, self._demodulator, self.correlator, 
self.framer_sink)
-        
+
         self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
 
 
diff --git a/gr-digital/python/digital/psk.py b/gr-digital/python/digital/psk.py
index 0e0c65e..d7ec4c9 100644
--- a/gr-digital/python/digital/psk.py
+++ b/gr-digital/python/digital/psk.py
@@ -68,7 +68,7 @@ def psk_constellation(m=_def_constellation_points, 
mod_code=_def_mod_code,
     """
     k = log(m) / log(2.0)
     if (k != int(k)):
-        raise StandardError('Number of constellation points must be a power of 
two.')
+        raise Exception('Number of constellation points must be a power of 
two.')
     points = [exp(2*pi*(0+1j)*i/m) for i in range(0,m)]
     pre_diff_code, post_diff_code = create_encodings(mod_code, m, differential)
     if post_diff_code is not None:
diff --git a/gr-digital/python/digital/qam.py b/gr-digital/python/digital/qam.py
index 518be78..55a82a9 100644
--- a/gr-digital/python/digital/qam.py
+++ b/gr-digital/python/digital/qam.py
@@ -100,7 +100,7 @@ def make_differential_constellation(m, gray_coded):
             return complex(-gc_to_x[gc_x], -gc_to_x[gc_y])
         if quad == 3:
             return complex(gc_to_x[gc_y], -gc_to_x[gc_x])
-        raise StandardError("Impossible!")
+        raise Exception("Impossible!")
 
     # First two bits determine quadrant.
     # Next (k-2)/2 bits determine x position.
diff --git a/gr-digital/python/digital/soft_dec_lut_gen.py 
b/gr-digital/python/digital/soft_dec_lut_gen.py
index f517277..f55265c 100644
--- a/gr-digital/python/digital/soft_dec_lut_gen.py
+++ b/gr-digital/python/digital/soft_dec_lut_gen.py
@@ -20,6 +20,8 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+
 import numpy
 
 def soft_dec_table_generator(soft_dec_gen, prec, Es=1):
@@ -252,4 +254,4 @@ def show_table(table):
                 pp += ") "
         pp += "\n"
         subj = 0
-    print pp
+    print(pp)
diff --git a/gr-digital/python/digital/test_soft_decisions.py 
b/gr-digital/python/digital/test_soft_decisions.py
index 7871410..21b529a 100755
--- a/gr-digital/python/digital/test_soft_decisions.py
+++ b/gr-digital/python/digital/test_soft_decisions.py
@@ -1,24 +1,26 @@
 #!/usr/bin/env python
 #
 # Copyright 2013 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 __future__ import print_function
 
 import numpy, pylab, sys
 from gnuradio import digital
@@ -114,12 +116,12 @@ if __name__ == "__main__":
 
     k = numpy.log2(len(constel))
 
-    print "Sample: ", x
-    print "Python Generator Calculated: ", (y_python_gen_calc)
-    print "Python Generator Table:      ", (y_python_table)
-    print "Python Raw calc:             ", (y_python_raw_calc)
-    print "C++ Table calc:              ", (y_cpp_table)
-    print "C++ Raw calc:                ", (y_cpp_raw_calc)
+    print("Sample: ", x)
+    print("Python Generator Calculated: ", (y_python_gen_calc))
+    print("Python Generator Table:      ", (y_python_table))
+    print("Python Raw calc:             ", (y_python_raw_calc))
+    print("C++ Table calc:              ", (y_cpp_table))
+    print("C++ Raw calc:                ", (y_cpp_raw_calc))
 
     fig = pylab.figure(1)
     sp1 = fig.add_subplot(1,1,1)
diff --git a/gr-digital/python/digital/utils/tagged_streams.py 
b/gr-digital/python/digital/utils/tagged_streams.py
index 4b393bf..ca68af2 100644
--- a/gr-digital/python/digital/utils/tagged_streams.py
+++ b/gr-digital/python/digital/utils/tagged_streams.py
@@ -75,7 +75,7 @@ def count_bursts(data, tags, lengthtagname, vlen=1):
         if pos in lengths:
             if in_packet:
                 print("Got tag at pos {0} current packet_pos is 
{1}".format(pos, packet_pos))
-                raise StandardError("Received packet tag while in packet.")
+                raise Exception("Received packet tag while in packet.")
             packet_pos = -1
             packet_length = lengths[pos]
             in_packet = True



reply via email to

[Prev in Thread] Current Thread [Next in Thread]