From 52d823ce85eb683aee4c91bb9473a7c2d20b1cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Fri, 31 Aug 2018 16:43:37 +0200 Subject: [PATCH] Fix a ResourceWarning: unclosed file in core.py --- httpbin/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/httpbin/core.py b/httpbin/core.py index dd25f1b..305c988 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -1725,7 +1725,8 @@ def image_svg(): def resource(filename): path = os.path.join(tmpl_dir, filename) - return open(path, "rb").read() + with open(path, "rb") as f: + return f.read() @app.route("/xml")