From 604799baf4fd6e7a9c9f9eab556596c98c112dc0 Mon Sep 17 00:00:00 2001 From: Markus Weber Date: Mon, 30 May 2022 17:20:09 +0200 Subject: [PATCH] no_restore_config ignores excpetion when read_data("firmware") --- lib/python/moteus/moteus_tool.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/python/moteus/moteus_tool.py b/lib/python/moteus/moteus_tool.py index a4d9606e..dfb97b75 100644 --- a/lib/python/moteus/moteus_tool.py +++ b/lib/python/moteus/moteus_tool.py @@ -30,6 +30,7 @@ import tempfile import time import uuid +import traceback from . import moteus from . import aiostream @@ -454,7 +455,14 @@ async def do_flash(self, elffile): if not self.args.bootloader_active: # Get the current firmware version. - old_firmware = await self.read_data("firmware") + try: + old_firmware = await self.read_data("firmware") + except RuntimeError as e: + if self.args.no_restore_config: + pass + else: + print(f"Couldn't calpture old config. Consider using --no_restore_config to skip this step.") + raise e upgrade = FirmwareUpgrade( elf.firmware_version