From 5d0b8b1f6ca9da8520605c8ad9007ade1566ef64 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sat, 9 Mar 2019 20:57:14 +1030 Subject: [PATCH] Fix dft_detect usage and lsusb usage to support python3. --- auto_rx/autorx/scan.py | 3 ++- auto_rx/autorx/utils.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/auto_rx/autorx/scan.py b/auto_rx/autorx/scan.py index 93c1456..8172920 100644 --- a/auto_rx/autorx/scan.py +++ b/auto_rx/autorx/scan.py @@ -207,11 +207,12 @@ def detect_sonde(frequency, rs_path="./", dwell_time=10, sdr_fm='rtl_fm', device _start = time.time() ret_output = subprocess.check_output(rx_test_command, shell=True, stderr=FNULL) FNULL.close() + ret_output = ret_output.decode('utf8') except subprocess.CalledProcessError as e: # dft_detect returns a code of 1 if no sonde is detected. # logging.debug("Scanner - dfm_detect return code: %s" % e.returncode) if e.returncode >= 2: - ret_output = e.output + ret_output = e.output.decode('utf8') else: _runtime = time.time() - _start logging.debug("Scanner - dft_detect exited in %.1f seconds." % _runtime) diff --git a/auto_rx/autorx/utils.py b/auto_rx/autorx/utils.py index 5b7d76f..ed8b7f9 100644 --- a/auto_rx/autorx/utils.py +++ b/auto_rx/autorx/utils.py @@ -341,6 +341,8 @@ def lsusb(): FNULL = open(os.devnull, 'w') lsusb_raw_output = subprocess.check_output(['lsusb', '-v'], stderr=FNULL) FNULL.close() + # Convert from bytes. + lsusb_raw_output = lsusb_raw_output.decode('utf8') except Exception as e: logging.error("lsusb parse error - %s" % str(e)) return