From b57ee28ae7a92cfc70fcce7ab28346bd42885ed9 Mon Sep 17 00:00:00 2001 From: Simone Gaiarin Date: Sat, 14 Jan 2017 21:16:50 +0100 Subject: [PATCH] Add check on file existence --- aqt/editor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aqt/editor.py b/aqt/editor.py index 9ade7b5ace7..f687da67aae 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -488,6 +488,8 @@ def setupWeb(self): def resourceToData(self, path): """Convert a file (specified by a path) into a data URI.""" + if not os.path.exists(path): + raise FileNotFoundError mime, _ = mimetypes.guess_type(path) with open(path, 'rb') as fp: data = fp.read()