From 2f0530459ae5a2ae6b1c46a1083096d11d68cc83 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 19 Sep 2020 21:43:05 +0200 Subject: Fix some python3 issues --- glutte_serial_web.py | 2 +- serialrx.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glutte_serial_web.py b/glutte_serial_web.py index f9ef067..a1a10ee 100755 --- a/glutte_serial_web.py +++ b/glutte_serial_web.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # The MIT License (MIT) # diff --git a/serialrx.py b/serialrx.py index b3bb7f5..5f62fea 100644 --- a/serialrx.py +++ b/serialrx.py @@ -123,8 +123,8 @@ class SerialRX(threading.Thread): databyte = self.ser.read() self.line_accumulator.append(databyte) - if databyte == "\n": - line = "".join(self.line_accumulator) + if databyte == b"\n": + line = b"".join(self.line_accumulator).decode() self._parser.parse_message(line) self.data_lock.acquire() try: @@ -166,7 +166,7 @@ class SerialRX(threading.Thread): def unregister_client(self, queue): self.data_lock.acquire() try: - self.clients = filter(lambda x: id(x) != id(queue), self.clients) + self.clients = [x for x in self.clients if id(x) != id(queue)] except: raise finally: -- cgit v1.2.3