Fix encoding error when creating tools (#2876)

This commit fixes a `UnicodeDecodeError` when creating tools. This was
caused when reading template files.
This commit is contained in:
Vini Brasil
2025-05-21 09:31:13 -03:00
committed by GitHub
parent e21d54654c
commit eb6364284f

View File

@@ -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))