Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

Read as `str` no `bytes`

Thiago Morettocda1900b14d1
diff --git a/src/crewai/cli/deploy/main.py b/src/crewai/cli/deploy/main.py
index 9cb6f6c8c..51afdb5da 100644
--- a/src/crewai/cli/deploy/main.py
+++ b/src/crewai/cli/deploy/main.py
@@ -33,6 +33,10 @@ class DeployCommand:
raise SystemExit
self.project_name = get_project_name()
+ if self.project_name is None:
+ console.print("No project name found. Please ensure your project has a valid pyproject.toml file.", style="bold red")
+ raise SystemExit
+
self.client = CrewAPI(api_key=access_token)
def _handle_error(self, json_response: Dict[str, Any]) -> None:
diff --git a/src/crewai/cli/deploy/utils.py b/src/crewai/cli/deploy/utils.py
index 89bb89536..140e486a8 100644
--- a/src/crewai/cli/deploy/utils.py
+++ b/src/crewai/cli/deploy/utils.py
@@ -66,11 +66,11 @@ def get_git_remote_url() -> str | None:
return None
-def get_project_name(pyproject_path: str = "pyproject.toml"):
+def get_project_name(pyproject_path: str = "pyproject.toml") -> str | None:
"""Get the project name from the pyproject.toml file."""
try:
# Read the pyproject.toml file
- with open(pyproject_path, "rb") as f:
+ with open(pyproject_path, "r") as f:
pyproject_content = parse_toml(f.read())
# Extract the project name