diff --git a/autoagent/environment/browser_env.py b/autoagent/environment/browser_env.py index 45cefb0..13fbe0c 100644 --- a/autoagent/environment/browser_env.py +++ b/autoagent/environment/browser_env.py @@ -256,7 +256,7 @@ def _click_id(bid: str, button: Literal["left", "middle", "right"] = "left"): # 等待页面完全加载 # 增加等待时间,确保页面完全加载 page.wait_for_load_state("networkidle", timeout=3000) - except: + except Exception: pass return @@ -322,7 +322,7 @@ def tryToClickChallenge(this_page): (!document.body.textContent.includes("请完成以下操作,验证您是真人。") && !document.body.textContent.includes("Verify you are human by completing the action below.")) """, timeout=20000) - except: + except Exception: print("等待验证超时") # 检查是否仍在验证页面 diff --git a/autoagent/environment/local_env.py b/autoagent/environment/local_env.py index 5143b54..ec96a5f 100644 --- a/autoagent/environment/local_env.py +++ b/autoagent/environment/local_env.py @@ -66,7 +66,7 @@ def _find_conda_sh(self) -> str: conda_sh = Path(base_path) / "etc" / "profile.d" / "conda.sh" if conda_sh.exists(): return str(conda_sh) - except: + except (subprocess.SubprocessError, OSError): pass # 3. If all fails, return None and handle in run_command diff --git a/autoagent/registry.py b/autoagent/registry.py index ad67bab..a17f924 100644 --- a/autoagent/registry.py +++ b/autoagent/registry.py @@ -97,7 +97,7 @@ def wrapped_func(*args, **kwargs): wrapped_func = func try: file_path = os.path.abspath(inspect.getfile(func)) - except: + except (TypeError, OSError): file_path = "Unknown" # 获取函数信息