From 9c9db3a7a1c21e575f32c964d7e6260a5a158cdb Mon Sep 17 00:00:00 2001 From: Damien George <damien.p.george@gmail.com> Date: Sun, 19 Oct 2014 14:54:52 +0100 Subject: [PATCH] tools, pyboard.py: Allow exec argument to be bytes or str. --- tools/pyboard.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/pyboard.py b/tools/pyboard.py index f7bd92b26..40f2ac934 100644 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -71,7 +71,10 @@ class Pyboard: return ret def exec(self, command): - command_bytes = bytes(command, encoding='ascii') + if isinstance(command, bytes): + command_bytes = command + else: + command_bytes = bytes(command, encoding='ascii') for i in range(0, len(command_bytes), 32): self.serial.write(command_bytes[i:min(i+32, len(command_bytes))]) time.sleep(0.01) -- GitLab