From 1323e45dbd7659c4c033b78802d60b7f18f64e0c Mon Sep 17 00:00:00 2001 From: IrvingGao <1729854488@qq.com> Date: Thu, 13 Jun 2024 16:38:33 +0800 Subject: [PATCH] [scan] wifi --- wifi_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi_manager.py b/wifi_manager.py index 5295595..8336fff 100644 --- a/wifi_manager.py +++ b/wifi_manager.py @@ -160,7 +160,6 @@ def init_networkmanager_file(): def check_wifi_connection(): cmd = "nmcli dev status" result = subprocess.run(cmd, shell=True, capture_output=True, text=True) - time.sleep(1) # 等待1秒,确保nmcli命令执行完成 output = result.stdout.strip() lines = output.split("\n")[1:] # Skip the header line for line in lines: @@ -188,6 +187,7 @@ def scan_wifi(): subprocess.run(['nmcli', 'dev', 'wifi', 'rescan'], check=True) cmd = "nmcli dev wifi" result = subprocess.run(cmd, shell=True, capture_output=True, text=True) + time.sleep(1) # 等待1秒,确保nmcli命令执行完成 except subprocess.CalledProcessError as e: logging.info(f"{datetime.datetime.now()}: Error scanning Wi-Fi: {e}") network_error_light_1()