From c14ff6194c224190c7e6787a2bffbdbb495be4b4 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Thu, 9 Jan 2020 16:33:31 +0100 Subject: [PATCH] esp8266/modules: Fix AttributeError in _boot.py if flash not formatted. Prior to this commit, if the flash filesystem was not formatted then it would error: "AttributeError: 'FlashBdev' object has no attribute 'mount'". That is due to it not being able to detect the filesystem on the block device and just trying to mount the block device directly. This commit fixes the issue by just catching all exceptions. Also it's not needed to try the mount if `flashbdev.bdev` is None. --- ports/esp8266/modules/_boot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/esp8266/modules/_boot.py b/ports/esp8266/modules/_boot.py index 81eb20dd63..4c2aa87fe5 100644 --- a/ports/esp8266/modules/_boot.py +++ b/ports/esp8266/modules/_boot.py @@ -3,11 +3,11 @@ gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4) import uos from flashbdev import bdev -try: - if bdev: +if bdev: + try: uos.mount(bdev, '/') -except OSError: - import inisetup - inisetup.setup() + except: + import inisetup + inisetup.setup() gc.collect()