2

I'm just installed QGIS 2.2 and created a new plugin from Plugin Builder. When I try to compile the plugin using:

C:\Program Files\QGIS Valmiera\bin>pyuic4 -o C:\Program Files\QGIS Valmiera\bin\ myplugin\ui_myplugin.py C:\Program Files\QGIS Valmiera\bin\myplugin\ui_ myplugin.ui

I received the error message "Error: one input ui-file must be specified".

Someone could help me solve this issue? I'm running over Windows 8 OS.

Thanks, Mateus

2
  • 1
    Could be an issue of spaces in the file paths
    – underdark
    Commented Mar 20, 2014 at 20:10
  • It's definitely an issue with spaces: you need to quote the file names. There also might be a typo: the last "_" is followed by a space which you probably do not want to be there.
    – whuber
    Commented Mar 20, 2014 at 20:42

4 Answers 4

3

Open cmd and go to the folder "myplugin" (with comand "cd").

Then run:

pyuic4 -o ui_myplugin.py ui_myplugin.ui
2
  • Hello and thanks for your help. Unfortunately I tried this before and I receive the error message: "'pyuic4' is not recognized as an internal or external command, operable program or batch file.". To solve this issue I must run pyuic4 from the folder "C:\Program Files\QGIS Valmiera\bin"
    – mbonad
    Commented Mar 21, 2014 at 18:35
  • 1
    You could also run it as "C:\Program Files\QGIS Valmiera\bin\pyuic4"
    – BradHards
    Commented Mar 21, 2014 at 22:34
2

As suggested by underdark and whuber, the white-space characters matter.

whuber pointed out that you probably have a typo in the ui_ myplugin.ui name, which should be ui_myplugin.ui. If so, you also have extra space in the bin\ myplugin in the first file path parameter. That should be bin\myplugin

There is a more general issue in that "Program Files" and "QGIS Valmiera" have spaces, so what you end up with (from the perspective of pyuic) is an output file of "C:Program", and extra arguments of "Files\QGIS", "Valmiera\bin\", "myplugin\ui_myplugin.py", "C:\Program, "Files\QGIS", "Valmiera\bin\myplugin\ui_" and "myplugin.ui". Each space delimits arguments.

So you should probably use:

pyuic4 -o "C:\Program Files\QGIS Valmiera\bin\myplugin\ui_myplugin.py" "C:\Program Files\QGIS Valmiera\bin\myplugin\ui_myplugin.ui"

1
  • Hello Brad and thanks for your help. You're right. I solve the issue adding "" as you described. Thanks!!! However, now I receive another error message: "Error: Permission denied: "C:\Program Files\QGIS Valmiera\bin\myplugin\ui_myplugin.py". I believe this is because windows don't allow me to write in this folder. Do you know how to solve this? Thanks.
    – mbonad
    Commented Mar 21, 2014 at 18:38
2
  1. Open OSGeo4W Shell from Start Menu/Screen, it should be installed.
  2. Use change directory command cd

    cd "C:\Program Files\QGIS Valmiera\bin\myplugin\"
    
  3. Execute command without paths

    pyuic4 -o ui_myplugin.py ui_myplugin.ui
    

I think calling it directly on windows confuses things because pyuic4 is actually a batch file that executes some python script and somewhere along the lines the paths get lost. Seems easier to let the OSGeo4W shell handle things.

1

I've ran in the same problem with the current QGIS 2.6.1 by just typing make I had the same error. I've searched for the pyuic4.bat file and it was located correctly. SO I just used the absolute path in the OSGEO4W Shell:

C:\Users\ricckli\.qgis2\python\plugins\qgis2leaf>make
pyuic4 -o ui_qgis2leaf.py ui_qgis2leaf.ui
make: pyuic4: Command not found
make: *** [ui_qgis2leaf.py] Error 127

This one was working without a problem:

C:\Users\ricckli\.qgis2\python\plugins\qgis2leaf>C:\OSGeo4W64\bin\pyuic4 -o ui_q
gis2leaf.py ui_qgis2leaf.ui

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.