From 1b8297b80907b74ce1937f774e483c1242f7ab4e Mon Sep 17 00:00:00 2001 From: Piotr Dobrowolski Date: Sun, 20 Oct 2019 08:24:53 +0200 Subject: [PATCH] py9b/transport/ninebot: fix python3 supprt --- py9b/transport/ninebot.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/py9b/transport/ninebot.py b/py9b/transport/ninebot.py index 0866a20..94b1061 100644 --- a/py9b/transport/ninebot.py +++ b/py9b/transport/ninebot.py @@ -14,13 +14,13 @@ class NinebotTransport(BT): while True: while True: c = self.link.read(1) - if c=="\x5A": + if c==b"\x5A": break while True: c = self.link.read(1) - if c=="\xA5": - return True - if c!="\x5A": + if c==b"\xA5": + return True + if c!=b"\x5A": break # start waiting 5A again, else - this is 5A, so wait for A5 @@ -28,19 +28,19 @@ class NinebotTransport(BT): self._wait_pre() pkt = self.link.read(1) l = ord(pkt)+6 - for i in xrange(l): + for i in range(l): pkt += self.link.read(1) ck_calc = checksum(pkt[0:-2]) ck_pkt = unpack("