From 2f66412afaca4a42319c666958c89827edd8f2f3 Mon Sep 17 00:00:00 2001
From: Brennan Ashton <bashton@brennanashton.com>
Date: Wed, 14 Nov 2018 17:53:22 -0800
Subject: gr-runtime: Improve exception handling in ControlPort Monitor

---
 gnuradio-runtime/python/gnuradio/ctrlport/monitor.py | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

(limited to 'gnuradio-runtime/python/gnuradio/ctrlport/monitor.py')

diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py b/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
index 87d6cb9e7f..0cc05be63e 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
@@ -33,15 +33,12 @@ class monitor(object):
         self.tool = tool
         atexit.register(self.shutdown)
 
-        try:
-            # setup export prefs
-            gr.prefs().singleton().set_bool("ControlPort","on",True);
-            if(tool == "gr-perf-monitorx"):
-                gr.prefs().singleton().set_bool("ControlPort","edges_list",True);
-                gr.prefs().singleton().set_bool("PerfCounters","on",True);
-                gr.prefs().singleton().set_bool("PerfCounters","export",True);
-        except:
-            print("no support for gr.prefs setting")
+        # setup export prefs
+        gr.prefs().singleton().set_bool("ControlPort","on",True);
+        if(tool == "gr-perf-monitorx"):
+            gr.prefs().singleton().set_bool("ControlPort","edges_list",True);
+            gr.prefs().singleton().set_bool("PerfCounters","on",True);
+            gr.prefs().singleton().set_bool("PerfCounters","export",True);
 
     def __del__(self):
         if(self.started):
@@ -57,7 +54,7 @@ class monitor(object):
             print("running: %s"%(str(cmd)))
             self.proc = subprocess.Popen(cmd);
             self.started = True
-        except:
+        except (ValueError, OSError):
             self.proc = None
             print("failed to to start ControlPort Monitor on specified port")
 
-- 
cgit v1.2.3