[GIS] QGIS Plugin Import Error on QGIS start

errorqgisqgis-plugins

I have been getting a bit of an odd error when starting QGIS concerning the loading of one of my own plugins

Traceback (most recent call last):
File "G:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 219, in startPlugin
plugins[packageName] = package.classFactory(iface)
File "E:\GitHub\QDriller\QDrillerPlugin\__init__.py", line 34, in classFactory
from .qdriller import QDriller
File "G:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 478, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "E:\GitHub\QDriller\QDrillerPlugin\qdriller.py", line 27, in 
from qdriller_dialog import QDrillerDialog
File "G:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 478, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "E:\GitHub\QDriller\QDrillerPlugin\qdriller_dialog.py", line 417, in 
os.path.dirname(__file__), 'sectionview_base.ui'))
File "G:\OSGEO4~1\apps\Python27\lib\site-packages\PyQt4\uic\__init__.py", line 213,in loadUiType
exec(code_string.getvalue(), ui_globals)
File "", line 219, in 
File "G:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 478, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named resources_rc

Now usually this would be because there is a mismatch in the name of the resources module called in the main plugin module (qdriller.py).

However, i have called my resources module 'resources', both in the code and the plugin directory. All my gui elements work and the resources are present (and have been changed and recompiled since first getting the error), and the plugin runs when reactivated using the plugin manager once QGIS is running.

This error occurs regardless of what the import call/resources file are called, i have tried "resources", "resources_rc", "foobar" etc. All cause the error but in all cases the gui and resources still work

This is also the case across 3 different installs of 2.8 and 2.8.1

Best Answer

The answer here worked for me

Basically, open up the .ui file in a text editor and remove the 'include location="resources.qrc"/' line... not sure why

Related Question