From ebb413b6b1e59e141c50d9466ab8b95d1628b84a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 28 Nov 2015 19:51:27 +0100 Subject: [PATCH] Handle exceptions in load_extensions This will skip those extensions, instead of crashing mopidy, e.g. when mopidy-mopify fails because of a missing HOME environment variable during mopidy's tests. Ref: https://github.com/dirkgroenen/mopidy-mopify/issues/119 --- mopidy/ext.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mopidy/ext.py b/mopidy/ext.py index fe8d0daf..48a623bb 100644 --- a/mopidy/ext.py +++ b/mopidy/ext.py @@ -198,7 +198,12 @@ def load_extensions(): for entry_point in pkg_resources.iter_entry_points('mopidy.ext'): logger.debug('Loading entry point: %s', entry_point) - extension_class = entry_point.load(require=False) + try: + extension_class = entry_point.load(require=False) + except Exception as e: + logger.exception("Failed to load extension %s: %s" % ( + entry_point.name, e)) + continue try: if not issubclass(extension_class, Extension):