File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 28
28
29
29
"""
30
30
31
- from qgis .PyQt .QtCore import QCoreApplication , QLocale , QThread
31
+ from qgis .PyQt .QtCore import QCoreApplication , QLocale , QThread , qDebug
32
32
from qgis .PyQt .QtWidgets import QPushButton , QApplication
33
33
from qgis .core import Qgis , QgsMessageLog , qgsfunction , QgsMessageOutput
34
34
from qgis .gui import QgsMessageBar
@@ -452,12 +452,23 @@ def _unloadPluginModules(packageName):
452
452
if hasattr (sys .modules [mod ], 'qCleanupResources' ):
453
453
sys .modules [mod ].qCleanupResources ()
454
454
except :
455
- pass
455
+ # Print stack trace for debug
456
+ qDebug ("qCleanupResources error:\n %s" % traceback .format_exc ())
457
+
458
+ # try removing path
459
+ if hasattr (sys .modules [mod ], '__path__' ):
460
+ for path in sys .modules [mod ].__path__ :
461
+ try :
462
+ sys .path .remove (path )
463
+ except ValueError :
464
+ # Discard if path is not there
465
+ pass
466
+
456
467
# try to remove the module from python
457
468
try :
458
469
del sys .modules [mod ]
459
470
except :
460
- pass
471
+ qDebug ( "Error when removing module: \n %s" % traceback . format_exc ())
461
472
# remove the plugin entry
462
473
del _plugin_modules [packageName ]
463
474
You can’t perform that action at this time.
0 commit comments