Navigation Menu

Skip to content

Commit

Permalink
Add check on file existence
Browse files Browse the repository at this point in the history
  • Loading branch information
simgunz committed Jan 14, 2017
1 parent a5c24aa commit b57ee28
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aqt/editor.py
Expand Up @@ -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()
Expand Down

0 comments on commit b57ee28

Please sign in to comment.