From 660081ece233b7c9caaa15fd63dcdeba50081443 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Wed, 3 Jun 2020 17:28:08 -0500 Subject: tools/cpboard.py: change 'async' variable usage; 'async' became a keyword in CPython 3.7 --- tools/cpboard.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/cpboard.py b/tools/cpboard.py index 0b9c43c61..7bb6daaeb 100644 --- a/tools/cpboard.py +++ b/tools/cpboard.py @@ -118,7 +118,7 @@ class REPL: self.write(b'\r' + REPL.CHAR_CTRL_B) # enter or reset friendly repl data = self.read_until(b'>>> ') - def execute(self, code, timeout=10, async=False): + def execute(self, code, timeout=10, wait_for_response=False): self.read() # Throw away self.write(REPL.CHAR_CTRL_A) @@ -127,7 +127,7 @@ class REPL: self.write(code) self.write(REPL.CHAR_CTRL_D) - if async: + if wait_for_response: return b'', b'' self.read_until(b'OK') @@ -424,10 +424,11 @@ class CPboard: self.serial.close() self.serial = None - def exec(self, command, timeout=10, async=False): + def exec(self, command, timeout=10, wait_for_response=False): with self.repl as repl: try: - output, error = repl.execute(command, timeout=timeout, async=async) + output, error = repl.execute(command, timeout=timeout, + wait_for_response=wait_for_response) except OSError as e: if self.debug: print('exec: session: ', self.repl.session) @@ -451,7 +452,8 @@ class CPboard: def _reset(self, mode='NORMAL'): self.exec("import microcontroller;microcontroller.on_next_reset(microcontroller.RunMode.%s)" % mode) try: - self.exec("import microcontroller;microcontroller.reset()", async=True) + self.exec("import microcontroller;microcontroller.reset()", + wait_for_response=True) except OSError: pass -- cgit v1.2.3