Skip to content

Commit

Permalink
HACK: attempt to re-start a plugin if startup fails due to odd "The o…
Browse files Browse the repository at this point in the history
…peration completed successfully" error
  • Loading branch information
manisandro committed May 25, 2023
1 parent 830c036 commit 1677b6c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,17 @@ def _startPlugin(packageName: str) -> bool:
# create an instance of the plugin
try:
plugins[packageName] = package.classFactory(iface)
except OSError as e:
if "The operation completed successfully" in str(e):
_unloadPluginModules(packageName)
try:
plugins[packageName] = package.classFactory(iface)
except:
_unloadPluginModules(packageName)
errMsg = QCoreApplication.translate("Python", "Couldn't load plugin '{0}'").format(packageName)
msg = QCoreApplication.translate("Python", "{0} due to an error when calling its classFactory() method").format(errMsg)
showException(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2], msg, messagebar=True, level=Qgis.Critical)
return False
except:
_unloadPluginModules(packageName)
errMsg = QCoreApplication.translate("Python", "Couldn't load plugin '{0}'").format(packageName)
Expand Down

0 comments on commit 1677b6c

Please sign in to comment.