From 462f84c1eeed0306409e91dd6e27875f3fa562d2 Mon Sep 17 00:00:00 2001 From: Eduardo Chiarotti Date: Fri, 11 Oct 2024 17:48:21 -0300 Subject: [PATCH] feat: add validation for poetry migration --- src/crewai/cli/run_crew.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/crewai/cli/run_crew.py b/src/crewai/cli/run_crew.py index 2d246cb0d..338f44e01 100644 --- a/src/crewai/cli/run_crew.py +++ b/src/crewai/cli/run_crew.py @@ -8,20 +8,17 @@ def run_crew() -> None: Run the crew by running a command in the UV environment. """ command = ["uv", "run", "run_crew"] - try: - result = subprocess.run(command, capture_output=False, text=True, check=True) - - if result.stderr: - click.echo(result.stderr, err=True) + subprocess.run(command, capture_output=True, text=True, check=True) except subprocess.CalledProcessError as e: click.echo(f"An error occurred while running the crew: {e}", err=True) click.echo(e.output, err=True, nl=True) - click.secho( - "It's possible that you are using an old version of crewAI that uses poetry, please run `crewai update` to update your pyproject.toml to use uv.", - fg="yellow", - ) + if "table found" in e.stderr: + click.secho( + "It's possible that you are using an old version of crewAI that uses poetry, please run `crewai update` to update your pyproject.toml to use uv.", + fg="yellow", + ) except Exception as e: click.echo(f"An unexpected error occurred: {e}", err=True)