1

I'm trying to build a basic plugin using plugin builder but I can't even compile it. I tried following a few tutorials and just trying to compile whatever but that always results in the same problem.

Error messages for rcc4.exe and uic4.bin:

"C:\Program Files\QGIS Chugiak\bin\pyrcc4" -o my_plugin.py my_plugin_dialog_base.ui
No resources in resource description.   

"C:\Program Files\QGIS Chugiak\bin\pyuic4" -o my_plugin.py my_plugin_dialog_base.ui
ImportError: No module named site

relevant files in the plugin folder:

my_plugin.py
my_plugin_dialog.py
my_plugin_dialog_base.ui
resources.qrc

What's in the /bin folder:

pyrcc4.exe
pyuic4.bat
pyuic4.bat.tmpl

Any idea what's wrong? I'm limited to using whatever's installed with QGIS to compile this, by the way.

1

You only need to run

pyrcc4 -o resources_rc.py resources.qrc

The .ui file is loaded dynamically in the recent versions of the default plugin code. For example, if the plugin is called test, the corresponding GUI loading code in test_dialog.py is

FORM_CLASS, _ = uic.loadUiType(os.path.join(
   os.path.dirname(__file__), 'test_dialog_base.ui'))

All necessary instructions are provided in the Plugin Builder popup which appears after the plugin is created.

1
  • Thanks - I actually followed one of your guides ( anitagraser.com/2014/04/26/…). You mentioned running pyuic4 -o ui_buildertest.py ui_buildertest.ui first. I also was a bit confused that nothing indicated that the process was successful. Just two points you might want to consider if you decide to update your guide (which was quite helpful).
    – MapEngine
    Feb 28 '15 at 12:27
1

I know I'm coming a bit late, but a quicker way to do this (provided that you're using Windows), is by using the OSGeo4W Shell. Make command will work from there.

Source and I've also tested it QGIS version 2.8.1 if that adds any more relevance.

Best regards,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.