Skip to content

Commit

Permalink
Merge pull request #109 from jaredd/master
Browse files Browse the repository at this point in the history
Fix python3 error w.r.t. modifying a list in place. Also fix SBS1 interface. Author: Jared Dulmage/github.com/jaredd
  • Loading branch information
bistromath authored May 6, 2020
2 parents a2f2627 + 6614f6c commit 9e2515a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/cpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ def set_location(self, new_location):

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]

Expand Down
2 changes: 1 addition & 1 deletion python/msprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def handle0(self, msg):
except ADSBError:
return

if msg.data["vs"] is 1:
if msg.data["vs"] == 1:
retstr += " (aircraft is on the ground)"

self._print(retstr)
Expand Down
3 changes: 2 additions & 1 deletion python/sbs1.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ def output(self, msg):
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))
Expand Down

0 comments on commit 9e2515a

Please sign in to comment.