From c5dcd3b70413deb518658c111dc9597fe08700c5 Mon Sep 17 00:00:00 2001 From: Yuante Li <104308117+WinstonLiyt@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:54:05 +0800 Subject: [PATCH] fix: fix a bug in regular expression exception processing (#734) * fix a bug in regular expression exception precessing * fix ci * fix --- rdagent/utils/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rdagent/utils/__init__.py b/rdagent/utils/__init__.py index ef20f6ac..904b6dd6 100644 --- a/rdagent/utils/__init__.py +++ b/rdagent/utils/__init__.py @@ -15,6 +15,7 @@ from pathlib import Path from types import ModuleType from typing import Union +from rdagent.log import rdagent_logger as logger from rdagent.oai.llm_conf import LLM_SETTINGS from rdagent.utils.agent.tpl import T @@ -139,9 +140,7 @@ def filter_redundant_text(stdout: str) -> str: if not needs_sub: break filtered_stdout = re.sub(r"\s*\n\s*", "\n", filtered_stdout) - except re.error as e: # sometime the generated regex pattern is invalid and yield exception. - from rdagent.log import rdagent_logger as logger - + except Exception as e: logger.error(f"Error in filtering progress bar: due to {e}") return filtered_stdout