diff options
author | Brennan Ashton <bashton@brennanashton.com> | 2018-11-14 17:52:20 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-11-15 15:44:05 -0800 |
commit | 39b74849d939456a0d1e4aa534e9f829e742ba63 (patch) | |
tree | 5b712759dd0cd2d40e83490ebb62838f42af2852 | |
parent | 0b57505367565224fa2967095d134005248d6a84 (diff) |
gr-runtime: Properly handle optional support for thrift RPC Transport
-rw-r--r-- | gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py | 11 | ||||
-rw-r--r-- | gr-dtv/examples/atsc_ctrlport_monitor.py | 6 |
2 files changed, 13 insertions, 4 deletions
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py b/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py index 8b811ab9d9..8249d341ec 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py +++ b/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py @@ -30,6 +30,15 @@ is currently the only supported transport. from __future__ import print_function from __future__ import unicode_literals +from gnuradio.ctrlport.RPCConnection import RPCMethods +try: + from gnuradio.ctrlport.RPCConnectionThrift import RPCConnectionThrift + from thrift.transport.TTransport import TTransportException +except ImportError: + # Thrift support not provided we should remove it from RPCMethods + pass + + """ GNURadioControlPortClient is the main class for creating a GNU Radio ControlPort client application for all transports. @@ -112,9 +121,7 @@ class GNURadioControlPortClient(object): self.client = None - from gnuradio.ctrlport.RPCConnection import RPCMethods if rpcmethod in RPCMethods: - from gnuradio.ctrlport.RPCConnectionThrift import RPCConnectionThrift if rpcmethod == 'thrift': #print("making RPCConnectionThrift") self.client = RPCConnectionThrift(host, port) diff --git a/gr-dtv/examples/atsc_ctrlport_monitor.py b/gr-dtv/examples/atsc_ctrlport_monitor.py index 9f233d9ff5..ad7cf03718 100644 --- a/gr-dtv/examples/atsc_ctrlport_monitor.py +++ b/gr-dtv/examples/atsc_ctrlport_monitor.py @@ -27,7 +27,9 @@ import matplotlib matplotlib.use("QT4Agg") import matplotlib.pyplot as plt import matplotlib.animation as animation -from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient +from gnuradio.ctrlport.GNURadioControlPortClient import ( + GNURadioControlPortClient, TTransportException, +) import numpy from numpy.fft import fftpack @@ -106,7 +108,7 @@ class atsc_ctrlport_monitor(object): self._viterbi_metric.pop() self._viterbi_metric.insert(0, vt_decoder_metrics) - except: + except TTransportException: sys.stderr.write("Lost connection, exiting") sys.exit(1) |