From e0a3b8187799a22b373e826573c0ce5e799e4d04 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 3 Sep 2022 12:08:17 +0300 Subject: [PATCH] Fixed "UnboundLocalError: local variable 'port' referenced before assignment" // Resolve #4407 --- platformio/device/finder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/device/finder.py b/platformio/device/finder.py index c93b9a90..0ef1b118 100644 --- a/platformio/device/finder.py +++ b/platformio/device/finder.py @@ -149,7 +149,7 @@ class SerialPortFinder: port = self._reveal_device_port(device) # pick the best PID:VID USB device - best_port = None + port = best_port = None for item in list_serial_ports(): if self.ensure_ready and not is_serial_port_ready(item["port"]): continue