From ef45fc9d810000da64ab8ad9f309906ff8c5db86 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 13 Sep 2024 17:22:36 +0200 Subject: [PATCH] fs/open --- rwx/fs/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rwx/fs/__init__.py b/rwx/fs/__init__.py index a7cc5b0..cb97ceb 100644 --- a/rwx/fs/__init__.py +++ b/rwx/fs/__init__.py @@ -77,5 +77,5 @@ def wipe(path: str) -> None: def write(file_path: str, text: str, charset: str = CHARSET) -> None: """Write text into a file.""" - with open(file_path, "bw") as file_object: - file_object.write(text.encode(charset)) + with Path(file_path).open(mode="w", encoding=charset) as file_object: + file_object.write(text)