eric6/MicroPython/UF2FlashDialog.py

changeset 8243
cc717c2ae956
parent 8222
5994b80b8760
child 8461
d9fb4a0f2460
diff -r aa713ac50c0d -r cc717c2ae956 eric6/MicroPython/UF2FlashDialog.py
--- a/eric6/MicroPython/UF2FlashDialog.py	Thu Apr 15 16:52:05 2021 +0200
+++ b/eric6/MicroPython/UF2FlashDialog.py	Thu Apr 15 18:11:24 2021 +0200
@@ -9,6 +9,7 @@
 
 import os
 import shutil
+import contextlib
 
 from PyQt5.QtCore import pyqtSlot, Qt, QCoreApplication, QThread, QEventLoop
 from PyQt5.QtWidgets import QDialog
@@ -479,7 +480,7 @@
     # second run for boards needing special treatment (e.g. RP2040)
     for board in SupportedUF2Boards:
         if not boardType or (board == boardType):
-            try:
+            with contextlib.suppress(KeyError):
                 # find mounted volume
                 volumes = SupportedUF2Boards[board]["volumes"][(0, 0)]
                 foundVolumes = []
@@ -492,9 +493,6 @@
                             "UF2FlashDialog", "'{0}' Board").format(board),
                         (0, 0),             # VID/PID of (0, 0) is special
                     ))
-            except KeyError:
-                # no special treatment required, carry on
-                pass
     
     return foundDevices
 

eric ide

mercurial