From 767503ad88750282a95f2dec3b9fce91c18f649f Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 14 Mar 2017 17:22:50 +0000 Subject: [PATCH] [#2979] Fix Deluge start error with missing entrypoints - An ImportError is raised if a module is listed in the entrypoint but is not actually installed. The code will now catch this and will de-list the ui module that failed. --- deluge/ui/ui_entry.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deluge/ui/ui_entry.py b/deluge/ui/ui_entry.py index 2d444cef7..4e4ae2b65 100644 --- a/deluge/ui/ui_entry.py +++ b/deluge/ui/ui_entry.py @@ -38,9 +38,15 @@ def start_ui(): setup_translations() # Get the registered UI entry points - ui_entrypoints = dict([(entrypoint.name, entrypoint.load()) - for entrypoint in pkg_resources.iter_entry_points('deluge.ui')]) - ui_titles = sorted(ui_entrypoints.keys()) + ui_entrypoints = {} + for entrypoint in pkg_resources.iter_entry_points('deluge.ui'): + try: + ui_entrypoints[entrypoint.name] = entrypoint.load() + except ImportError: + # Unable to load entrypoint so skip adding it. + pass + + ui_titles = sorted(ui_entrypoints) def add_ui_options_group(_parser): """Function to enable reuse of UI Options group"""