From f05be8dca2934e7c5d70c76b7c7e6b8180946abc Mon Sep 17 00:00:00 2001 From: vanten-s Date: Sat, 5 Aug 2023 10:38:54 +0200 Subject: [PATCH] Added try statement --- __init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index d31c8ce..e568118 100644 --- a/__init__.py +++ b/__init__.py @@ -17,8 +17,13 @@ def convert_case(string: str): return string def article_to_xml(article_path: pathlib.Path): - with (article_path / "article.md").open("r") as f: - markdown_data = f.read() + try: + with (article_path / "article.md").open("r") as f: + markdown_data = f.read() + + except Exception as e: + print(e) + return markdown_instance = markdown.Markdown(extensions=['meta', 'nl2br']) html = markdown_instance.convert(markdown_data)