diff --git a/octoprint_firmwareupdater/__init__.py b/octoprint_firmwareupdater/__init__.py index 4ff24cd..c7cea2c 100644 --- a/octoprint_firmwareupdater/__init__.py +++ b/octoprint_firmwareupdater/__init__.py @@ -361,6 +361,7 @@ def __init__(self, reason, *args, **kwargs): self.reason = reason __plugin_name__ = "Firmware Updater" +__plugin_pythoncompat__ = ">=2.7,<4" def __plugin_load__(): global __plugin_implementation__ diff --git a/octoprint_firmwareupdater/methods/avrdude.py b/octoprint_firmwareupdater/methods/avrdude.py index f49a28e..3dddb6f 100644 --- a/octoprint_firmwareupdater/methods/avrdude.py +++ b/octoprint_firmwareupdater/methods/avrdude.py @@ -83,11 +83,11 @@ def _flash_avrdude(self, firmware=None, printer_port=None): self._console_logger.info(u"") self._console_logger.info(avrdude_command) try: - p = sarge.run(avrdude_command, cwd=working_dir, async=True, stdout=sarge.Capture(), stderr=sarge.Capture()) + p = sarge.run(avrdude_command, cwd=working_dir, async_=True, stdout=sarge.Capture(), stderr=sarge.Capture()) p.wait_events() while p.returncode is None: - output = p.stderr.read(timeout=0.5) + output = p.stderr.read(timeout=0.5).decode('utf-8') if not output: p.commands[0].poll() continue diff --git a/octoprint_firmwareupdater/methods/bossac.py b/octoprint_firmwareupdater/methods/bossac.py index 177e272..3758294 100644 --- a/octoprint_firmwareupdater/methods/bossac.py +++ b/octoprint_firmwareupdater/methods/bossac.py @@ -61,11 +61,11 @@ def _flash_bossac(self, firmware=None, printer_port=None): self._console_logger.info(u"") self._console_logger.info(bossac_command) try: - p = sarge.run(bossac_command, cwd=working_dir, async=True, stdout=sarge.Capture(buffer_size=1), stderr=sarge.Capture(buffer_size=1)) + p = sarge.run(bossac_command, cwd=working_dir, async_=True, stdout=sarge.Capture(buffer_size=1), stderr=sarge.Capture(buffer_size=1)) p.wait_events() while p.returncode is None: - output = p.stdout.read(timeout=0.5) + output = p.stdout.read(timeout=0.5).decode('utf-8') if not output: p.commands[0].poll() continue @@ -90,7 +90,7 @@ def _flash_bossac(self, firmware=None, printer_port=None): if p.returncode == 0: return True else: - output = p.stderr.read(timeout=0.5) + output = p.stderr.read(timeout=0.5).decode('utf-8') for line in output.split("\n"): if line.endswith("\r"): line = line[:-1] diff --git a/octoprint_firmwareupdater/methods/dfuprog.py b/octoprint_firmwareupdater/methods/dfuprog.py index 7a2db95..013833d 100644 --- a/octoprint_firmwareupdater/methods/dfuprog.py +++ b/octoprint_firmwareupdater/methods/dfuprog.py @@ -50,11 +50,11 @@ def _flash_dfuprog(self, firmware=None, printer_port=None): self._send_status("progress", subtype="writing") self._console_logger.info(dfuprog_command) try: - p = sarge.run(dfuprog_command, cwd=working_dir, async=True, stdout=sarge.Capture(buffer_size=1), stderr=sarge.Capture(buffer_size=1)) + p = sarge.run(dfuprog_command, cwd=working_dir, async_=True, stdout=sarge.Capture(buffer_size=1), stderr=sarge.Capture(buffer_size=1)) p.wait_events() while p.returncode is None: - output = p.stderr.read(timeout=0.5) + output = p.stderr.read(timeout=0.5).decode('utf-8') if not output: p.commands[0].poll() continue @@ -100,11 +100,11 @@ def _erase_dfuprog(self): self._logger.info(u"Running '{}' in {}".format(dfuprog_erasecommand, working_dir)) self._console_logger.info(dfuprog_erasecommand) try: - p = sarge.run(dfuprog_erasecommand, cwd=working_dir, async=True, stdout=sarge.Capture(buffer_size=1), stderr=sarge.Capture(buffer_size=1)) + p = sarge.run(dfuprog_erasecommand, cwd=working_dir, async_=True, stdout=sarge.Capture(buffer_size=1), stderr=sarge.Capture(buffer_size=1)) p.wait_events() while p.returncode is None: - output = p.stderr.read(timeout=0.5) + output = p.stderr.read(timeout=0.5).decode('utf-8') if not output: p.commands[0].poll() continue diff --git a/octoprint_firmwareupdater/methods/stm32flash.py b/octoprint_firmwareupdater/methods/stm32flash.py index 6baea23..208b5ac 100644 --- a/octoprint_firmwareupdater/methods/stm32flash.py +++ b/octoprint_firmwareupdater/methods/stm32flash.py @@ -74,11 +74,11 @@ def _flash_stm32flash(self, firmware=None, printer_port=None): self._console_logger.info(stm32flash_command) try: - p = sarge.run(stm32flash_command, cwd=working_dir, async=True, stdout=sarge.Capture(), stderr=sarge.Capture()) + p = sarge.run(stm32flash_command, cwd=working_dir, async_=True, stdout=sarge.Capture(), stderr=sarge.Capture()) p.wait_events() while p.returncode is None: - output = p.stdout.read(timeout=0.5) + output = p.stdout.read(timeout=0.5).decode('utf-8') if not output: p.commands[0].poll() continue @@ -95,7 +95,7 @@ def _flash_stm32flash(self, firmware=None, printer_port=None): if p.returncode == 0: return True else: - output = p.stderr.read(timeout=0.5) + output = p.stderr.read(timeout=0.5).decode('utf-8') for line in output.split("\n"): if line.endswith("\r"): line = line[:-1]