From 261ea7bebccc1d90264adbe983ad6262ce732475 Mon Sep 17 00:00:00 2001 From: Karl Dubost Date: Mon, 8 Jun 2020 10:30:00 +0900 Subject: [PATCH] Fix #12 - separate reading file from parsing --- trexa/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trexa/__init__.py b/trexa/__init__.py index 583c260..a09d76d 100644 --- a/trexa/__init__.py +++ b/trexa/__init__.py @@ -24,10 +24,9 @@ def index(): This module isn't intended to serve a useful website, so we just dump the README.md as HTML. """ - readme_file = open("README.md", "r") - md_template_string = markdown.markdown( - readme_file.read() - ) + with open("README.md", "r") as f: + readme_file = f.read() + md_template_string = markdown.markdown(readme_file) return md_template_string