diff -r aa713ac50c0d -r cc717c2ae956 eric6/PluginManager/PluginManager.py --- a/eric6/PluginManager/PluginManager.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/PluginManager/PluginManager.py Thu Apr 15 18:11:24 2021 +0200 @@ -161,11 +161,8 @@ self.__networkManager.sslErrors.connect(self.__sslErrors) self.__replies = [] - try: + with contextlib.suppress(AttributeError): self.__ui.onlineStateChanged.connect(self.__onlineStateChanged) - except AttributeError: - # it was not called from eric - pass def finalizeSetup(self): """ @@ -429,12 +426,10 @@ if reload_: importlib.reload(module) self.initOnDemandPlugin(name) - try: + with contextlib.suppress(KeyError, AttributeError): pluginObject = self.__onDemandInactivePlugins[name] pluginObject.initToolbar( self.__ui, e5App().getObject("ToolbarManager")) - except (KeyError, AttributeError): - pass except PluginLoadError: print("Error loading plug-in module:", name) except Exception as err: @@ -460,26 +455,18 @@ self.deactivatePlugin(name) if name in self.__inactiveModules: - try: + with contextlib.suppress(KeyError): pluginObject = self.__inactivePlugins[name] - try: + with contextlib.suppress(AttributeError): pluginObject.prepareUnload() - except AttributeError: - pass del self.__inactivePlugins[name] - except KeyError: - pass del self.__inactiveModules[name] elif name in self.__onDemandInactiveModules: - try: + with contextlib.suppress(KeyError): pluginObject = self.__onDemandInactivePlugins[name] - try: + with contextlib.suppress(AttributeError): pluginObject.prepareUnload() - except AttributeError: - pass del self.__onDemandInactivePlugins[name] - except KeyError: - pass del self.__onDemandInactiveModules[name] elif name in self.__failedModules: del self.__failedModules[name] @@ -562,11 +549,8 @@ """ self.initOnDemandPlugins() for pluginObject in self.__onDemandInactivePlugins.values(): - try: + with contextlib.suppress(AttributeError): pluginObject.initToolbar(self.__ui, toolbarManager) - except AttributeError: - # ignore it - pass def activatePlugins(self): """