From 4cf90dbcb7049c20cdf1b517baa4580f4a591821 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 22:00:44 +0000 Subject: [PATCH] Fix type-checker errors in utils.py Co-Authored-By: Joe Moura --- src/crewai/cli/utils.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/crewai/cli/utils.py b/src/crewai/cli/utils.py index f1c1336d3..847512ca1 100644 --- a/src/crewai/cli/utils.py +++ b/src/crewai/cli/utils.py @@ -83,14 +83,15 @@ def _get_project_attribute( pyproject_content = parse_toml(f.read()) import inspect - calling_frame = inspect.currentframe().f_back - calling_function = calling_frame.f_code.co_name - if calling_function != "reset_memories": - dependencies = ( - _get_nested_value(pyproject_content, ["project", "dependencies"]) or [] - ) - if not any(True for dep in dependencies if "crewai" in dep): - raise Exception("crewai is not in the dependencies.") + calling_frame = inspect.currentframe() + if calling_frame and calling_frame.f_back and calling_frame.f_back.f_code: + calling_function = calling_frame.f_back.f_code.co_name + if calling_function != "reset_memories": + dependencies = ( + _get_nested_value(pyproject_content, ["project", "dependencies"]) or [] + ) + if not any(True for dep in dependencies if "crewai" in dep): + raise Exception("crewai is not in the dependencies.") attribute = _get_nested_value(pyproject_content, keys) except FileNotFoundError: