From eb6364284fbdee118750012279ab0c2334d64d16 Mon Sep 17 00:00:00 2001 From: Vini Brasil Date: Wed, 21 May 2025 09:31:13 -0300 Subject: [PATCH] Fix encoding error when creating tools (#2876) This commit fixes a `UnicodeDecodeError` when creating tools. This was caused when reading template files. --- src/crewai/cli/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crewai/cli/utils.py b/src/crewai/cli/utils.py index 74fc414d9..f88213a58 100644 --- a/src/crewai/cli/utils.py +++ b/src/crewai/cli/utils.py @@ -161,7 +161,7 @@ def tree_find_and_replace(directory, find, replace): for filename in files: filepath = os.path.join(path, filename) - with open(filepath, "r") as file: + with open(filepath, "r", encoding="utf-8", errors="ignore") as file: contents = file.read() with open(filepath, "w") as file: file.write(contents.replace(find, replace))