From 897b4ef2cdba3abe49cd99c99ce556b0df780802 Mon Sep 17 00:00:00 2001 From: Idan Date: Fri, 23 Jun 2023 14:57:29 +0300 Subject: [PATCH] Fixed a bug with reading md files --- scripts/parser/file/markdown_parser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/parser/file/markdown_parser.py b/scripts/parser/file/markdown_parser.py index d8aeb3b0..2b4223df 100644 --- a/scripts/parser/file/markdown_parser.py +++ b/scripts/parser/file/markdown_parser.py @@ -119,8 +119,12 @@ class MarkdownParser(BaseParser): self, filepath: Path, errors: str = "ignore" ) -> List[Tuple[Optional[str], str]]: """Parse file into tuples.""" - with open(filepath, "r") as f: - content = f.read() + with open(filepath, "r", encoding='utf8') as f: + try: + content = f.read() + except (Exception,) as e: + print(f'Error a file: "{filepath}"') + raise e if self._remove_hyperlinks: content = self.remove_hyperlinks(content) if self._remove_images: