This problem is caused by uic
not working properly. I am not sure exactly why but I can show the symptoms and a workaround.
The initial plugin .ui
file has an empty resources
element:
<resources/>
When you edit the resources for the plugin in QtDesigner this changes to:
<resources>
<include location="resources.qrc"/>
</resources>
This is the source of the problem. If you change the .qrc file in that include tag to resourcesXXX.qrc
the error will change to No module named resourcesXXX_rc
.
Note: the following is based upon a plugin build with 'test' entered into all fields of the QGIS plugin builder.
In the test_dialog.py file the following lines compile the .ui file:
FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'test_dialog_base.ui'))
This is where the error is occurring.
Edit your .ui
file to change back to <resources/>
and the problem is resolved. Until you edit your dialog in QtDesigner again. You must make this edit to the .ui
file after each time you edit your dialog.
The solution to this is to change your plugin to work like earlier versions of the plugin worked. This involves replacing the uic call and the class lines in the _dialog.py file. Replace these lines:
FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'test_dialog_base.ui'))
class testDialog(QtGui.QDialog, FORM_CLASS):
with:
from test_dialog_base import Ui_testDialogBase
class testDialog(QDockWidget, Ui_testDialogBase):
You will now have to run
pyuic4 -x test_dialog_base.ui > test_dialog_base.py
when you first create your plugin and each time you edit your plugin dialog with QtDesigner. This was the old plugin method.
Whether to edit the .ui
file or the run pyuic4
each time is your choice.
No module named resources_napoved_rc
andpyrcc4 -o resources_napoved_rc.py resources_napoved.qrc
or is it a typing error ?file.qrc
in UI file. (very strange) I tried all possible combinations also:pyrcc4 -o resources_napoved_rc.py resources_napoved_rc.qrc
import resources_napoved_rc