From 16c2dc2aaf6ff0f5d95833353aafa869c3b120c1 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 2 Nov 2019 21:19:15 +0100 Subject: [PATCH] Fix stack trace decode for latest platformio (#830) --- esphome/platformio_api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/esphome/platformio_api.py b/esphome/platformio_api.py index 5cc4fad998..36e451c21d 100644 --- a/esphome/platformio_api.py +++ b/esphome/platformio_api.py @@ -101,12 +101,14 @@ def run_idedata(config): args = ['-t', 'idedata'] stdout = run_platformio_cli_run(config, False, *args, capture_stdout=True) stdout = decode_text(stdout) - match = re.search(r'{.*}', stdout) + match = re.search(r'{\s*".*}', stdout) if match is None: + _LOGGER.debug("Could not match IDEData for %s", stdout) return IDEData(None) try: return IDEData(json.loads(match.group())) except ValueError: + _LOGGER.debug("Could not load IDEData for %s", stdout, exc_info=1) return IDEData(None) @@ -165,11 +167,13 @@ ESP8266_EXCEPTION_CODES = { def _decode_pc(config, addr): idedata = get_idedata(config) if not idedata.addr2line_path or not idedata.firmware_elf_path: + _LOGGER.debug("decode_pc no addr2line") return command = [idedata.addr2line_path, '-pfiaC', '-e', idedata.firmware_elf_path, addr] try: - translation = subprocess.check_output(command).strip() + translation = decode_text(subprocess.check_output(command)).strip() except Exception: # pylint: disable=broad-except + _LOGGER.debug("Caught exception for command %s", command, exc_info=1) return if "?? ??:0" in translation: