Skip to content
Permalink
Browse files

[Backport release-3_4] Remove plugin module path when unloading (#9862)

* Remove plugin module path  when unloading

    Unloading plugin must remove added module path
    in order to prevent wrong package import when reloading
  • Loading branch information
backporting authored and m-kuhn committed May 11, 2019
1 parent 90abfe2 commit 9a492b48b8e40d56aa9190352791216f2570200f
Showing with 10 additions and 0 deletions.
  1. +10 −0 python/utils.py
@@ -415,6 +415,16 @@ def _unloadPluginModules(packageName):
sys.modules[mod].qCleanupResources()
except:
pass

# try removing path
if hasattr(sys.modules[mod], '__path__'):
for path in sys.modules[mod].__path__:
try:
sys.path.remove(path)
except ValueError:
# Discard if path is not there
pass

# try to remove the module from python
try:
del sys.modules[mod]

0 comments on commit 9a492b4

Please sign in to comment.
You can’t perform that action at this time.