encoding UTF8 (#6161)

This commit is contained in:
Sofie Van Landeghem 2020-09-29 14:49:55 +02:00 committed by GitHub
parent 3fa30a7f2d
commit 6a04e5adea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -114,6 +114,6 @@ def project_document(
content = f"{before}{content}{after}"
else:
msg.warn("Replacing existing file")
with output_file.open("w") as f:
with output_file.open("w", encoding="utf8") as f:
f.write(content)
msg.good("Saved project documentation", output_file)

View File

@ -700,7 +700,7 @@ from pathlib import Path
@spacy.registry.loggers("my_custom_logger.v1")
def custom_logger(log_path):
def setup_logger(nlp: "Language") -> Tuple[Callable, Callable]:
with Path(log_path).open("w") as file_:
with Path(log_path).open("w", encoding="utf8") as file_:
file_.write("step\\t")
file_.write("score\\t")
for pipe in nlp.pipe_names:

View File

@ -1256,7 +1256,7 @@ def main(template_path, output=None, data_path=None):
data_str = f"export const DATA = {data}"
result = compiler.get_output()
if output is not None:
with output.open("w") as f:
with output.open("w", encoding="utf8") as f:
f.write(f"{header}\n{result}\n{data_str}")
print(f"Updated {output.parts[-1]}")
else: