From f4a595a91de1c8733ecc8dd7d2d03390048a38be Mon Sep 17 00:00:00 2001 From: srt19 <90868790+srt19@users.noreply.github.com> Date: Tue, 8 Mar 2022 04:11:03 +0700 Subject: [PATCH] Fix error writing to txt file dunno why I always get error unicode message when writing to txt file --- manga_ocr/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manga_ocr/run.py b/manga_ocr/run.py index a45a965..8a1a74b 100644 --- a/manga_ocr/run.py +++ b/manga_ocr/run.py @@ -36,7 +36,7 @@ def process_and_write_results(mocr, img_or_path, write_to): if write_to.suffix != '.txt': raise ValueError('write_to must be either "clipboard" or a path to a text file') - with write_to.open('a') as f: + with write_to.open('a', encoding="utf-8") as f: f.write(text + '\n')