From 9dc3367aaf281dc6511523b30ab2992629a672aa Mon Sep 17 00:00:00 2001 From: Jared Dulmage Date: Tue, 5 May 2020 14:21:40 -0600 Subject: [PATCH 1/3] Replaced "is" with "==" to avoid SyntaxWarning --- python/msprint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/msprint.py b/python/msprint.py index c7aa7aa..15d88bc 100644 --- a/python/msprint.py +++ b/python/msprint.py @@ -80,7 +80,7 @@ class output_print: except ADSBError: return - if msg.data["vs"] is 1: + if msg.data["vs"] == 1: retstr += " (aircraft is on the ground)" self._print(retstr) From 5f7c6f57c810c4e45fdebca6725156df564a8d41 Mon Sep 17 00:00:00 2001 From: Jared Dulmage Date: Tue, 5 May 2020 14:22:20 -0600 Subject: [PATCH 2/3] Copy poslist items before deleting to avoid RuntimeError --- python/cpr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/cpr.py b/python/cpr.py index 1612250..ecb457e 100755 --- a/python/cpr.py +++ b/python/cpr.py @@ -193,11 +193,11 @@ class cpr_decoder: def weed_poslists(self): for poslist in [self.evenlist, self.oddlist]: - for key, item in poslist.items(): + for key, item in tuple(poslist.items()): if time.time() - item[2] > 10: del poslist[key] for poslist in [self.evenlist_sfc, self.oddlist_sfc]: - for key, item in poslist.items(): + for key, item in tuple(poslist.items()): if time.time() - item[2] > 25: del poslist[key] From 6614f6ce4322d6f4380cfbce367c6c330c6f8286 Mon Sep 17 00:00:00 2001 From: Jared Dulmage Date: Tue, 5 May 2020 22:56:50 -0600 Subject: [PATCH 3/3] Convert sbs message to bytes before sending --- python/sbs1.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/sbs1.py b/python/sbs1.py index c3a4bd3..a275a63 100644 --- a/python/sbs1.py +++ b/python/sbs1.py @@ -93,8 +93,9 @@ class output_sbs1: try: sbs1_msg = self.parse(msg) if sbs1_msg is not None: + sbs1_bytes = sbs1_msg.encode('utf-8') for conn in self._conns[:]: #iterate over a copy of the list - conn.send(sbs1_msg) + conn.send(sbs1_bytes) except socket.error: self._conns.remove(conn) print("Connections: ", len(self._conns))