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
This commit is contained in:
Daniel Hahler 2015-11-28 19:51:27 +01:00 committed by Stein Magnus Jodal
parent 22b18a46d1
commit ebb413b6b1

View File

@ -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)
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):