From 0ccf3018d5948f843ab9ff393300e5cfd497383e Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 12 Jun 2020 10:00:26 -0400 Subject: [PATCH] msgproto: Improve Python3 compatibility Signed-off-by: Kevin O'Connor --- klippy/msgproto.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/klippy/msgproto.py b/klippy/msgproto.py index 9f212f8d..72bdd534 100644 --- a/klippy/msgproto.py +++ b/klippy/msgproto.py @@ -80,7 +80,7 @@ class PT_string: out.extend(bytearray(v)) def parse(self, s, pos): l = s[pos] - return str(bytearray(s[pos+1:pos+l+1])), pos+l+1 + return bytes(bytearray(s[pos+1:pos+l+1])), pos+l+1 class PT_progmem_buffer(PT_string): pass class PT_buffer(PT_string): @@ -209,7 +209,7 @@ class UnknownFormat: name = '#unknown' def parse(self, s, pos): msgid = s[pos] - msg = str(bytearray(s)) + msg = bytes(bytearray(s)) return {'#msgid': msgid, '#msg': msg}, len(s)-MESSAGE_TRAILER_SIZE def format_params(self, params): return "#unknown %s" % (repr(params['#msg']),)