I am trying to build a plugin in Qgis2.6 using plugin builder. And as a part of the same, I tried compiling the .ui and .qrc file using OSGeo4W shell. It is showing an error during compilation in OSGeo4W shell. Please help me how to compile the ui as well as qrc file using OSGeo4W shell or reply me where I am wrong from the below attached error. I am new in QGis plugin creation. The plugin contents inside the folder also attached.

enter image description here

enter image description here

  • 1
    Wrap they file name in quotes: "CSV Export.py" etc
    – Nathan W
    Commented Jan 21, 2015 at 5:16
  • Thank you. Yeah the error disappears after wrapping the file name in quotes.But I wonder last time when I created I didn't wrap the filename in quotes but the compilation was successful.
    – User123
    Commented Jan 21, 2015 at 5:27
  • Avoid blank spaces in (Python) file names. It doesn't help you and will bring you troubles. Commented Jan 21, 2015 at 5:30

1 Answer 1


I will write a quick explanation of the pyuic4 and pyrcc4 commands for future reference. Most tutorials simply tell you to copy some code, but no one explains exactly what you are about to do. It is quite simple actually, but beginners might still struggle with it.

The Plugin Builder generates a fairly 'empty' plugin template. The two files that are of interest to us, as we need to convert them to Python files manually, are the GUI file (.ui) and the resource file (.qrc).

Let us assume my Plugin Builder leaves me with the following files when creating a template for a plugin that I named Color Changer: color_changer_dialog_base.ui and resources.qrc.

Now, to convert these files to Python (.py) files we need to move to a console (for example, the OSGeo4W Shell).

The syntax for the GUI conversion is:
pyuic4 -o nameOfTheFileWeWantToCreate.py nameOfOurExistingFile.ui

As in:

pyuic4 -o color_changer_dialog_base.py color_changer_dialog_base.ui

And the syntax for the resource file is:
pyrcc4 -o nameOfTheFileWeWantToCreate.py nameOfOurExistingFile.qrc

As in:

pyrcc4 -o resources_rc.py resources.qrc

Of course, all rules that generally apply in GIS or programming should be considered. In your case, consider not using blank spaces in file names.

So, this:
before conversion

through this:
OSGeo4W Shell

will become this:
after conversion

  • Thank you so much BritishSteel for your good explanation.Really your explanation helps me understanding a lot.
    – User123
    Commented Jan 27, 2015 at 17:27
  • 1
    Would be nice to have this updated for QGIS 3, pyuic5 and pyrcc5;
    – sigeal
    Commented Nov 5, 2017 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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