From 4be6deb94776744071311777f0b18efb993c0cfa Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 17 Apr 2018 20:24:20 -0700 Subject: [PATCH] Fix for plugins in Python 3.5 (#222) ModuleNotFoundError is not a thing in Python 3.5, so catch KeyError/ImportError instead. --- datasette/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datasette/app.py b/datasette/app.py index df2bd2ed..697a1aff 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -1308,8 +1308,8 @@ class Datasette: modpath = '/-/static-plugins/{}/'.format(plugin_module.__name__) dirpath = pkg_resources.resource_filename(plugin_module.__name__, 'static') app.static(modpath, dirpath) - except ModuleNotFoundError: - # Caused by --plugins_dir= plugins + except (KeyError, ImportError): + # Caused by --plugins_dir= plugins - KeyError/ImportError thrown in Py3.5 pass app.add_route( DatabaseView.as_view(self),