From aab4793fe8b39c14ca4fe282bca87f0a1afaea1b Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Tue, 7 Jan 2020 14:54:24 -0500 Subject: [PATCH] correct thes for compressed pkt; fix output format --- hbc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hbc b/hbc index 21d13ae..a1460f5 100755 --- a/hbc +++ b/hbc @@ -136,7 +136,7 @@ def dicttos(ID, d): def stodict(msg): d = {} - if len(msg) > 0 and chr(msg[0]) == "!": + if len(msg) > 0 and msg[0] == "!": pk = zlib.decompress(msg[5:]).decode() d['ID'] = msg[1:4].decode() else: @@ -334,7 +334,7 @@ def process(): try: msgDict = stodict(data) except Exception as e: - print("failed to parse incoming data from %s: " % (addr, data)) + print("failed to parse incoming data from %s: %s (%s)" % (addr, data, e)) continue if verbose: print("sock.recvfrom: %s (%s) %s" % (addr, len(data), str(msgDict)[:80]))