summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-10-26 22:03:46 +1100
committerDamien George <damien@micropython.org>2022-10-31 12:38:25 +1100
commit3427e12e8f3879bb5d285a6d379744ffadd8e986 (patch)
tree30322277d8967ee1ac473903757bb620b9e7e03c
parent7775523b2ded41ee8929522341c242eee43e9a48 (diff)
tools/mpremote: Handle FileNotFound exceptions in listdir.
The except handler for OSError didn't include the line that actually calls os.listdir, so an invalid path wasn't handled correctly. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
-rw-r--r--tools/mpremote/mpremote/pyboardextended.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/mpremote/mpremote/pyboardextended.py b/tools/mpremote/mpremote/pyboardextended.py
index d3b4cb6d8..075b95ae5 100644
--- a/tools/mpremote/mpremote/pyboardextended.py
+++ b/tools/mpremote/mpremote/pyboardextended.py
@@ -428,12 +428,11 @@ class PyboardCommand:
path = self.root + self.rd_str()
try:
self.path_check(path)
+ self.data_ilistdir[0] = path
+ self.data_ilistdir[1] = os.listdir(path)
self.wr_s8(0)
except OSError as er:
self.wr_s8(-abs(er.errno))
- else:
- self.data_ilistdir[0] = path
- self.data_ilistdir[1] = os.listdir(path)
def do_ilistdir_next(self):
if self.data_ilistdir[1]: