2

I'm following Building a Python Plugin (QGIS3) tutorial to set up the development environment for building QGIS3 python plugins in Win10. I have a problem compiling "pyrcc5". As explained in the tutorial I wrote the compile.bat:

@echo off
call "C:\Program Files\QGIS 3.4\bin\o4w_env.bat"
call "C:\Program Files\QGIS 3.4\bin\qt5_env.bat"
call "C:\Program Files\QGIS 3.4\bin\py3_env.bat"

@echo on
pyrcc5.bat -o resources.py resources.qrce

I copied compile.bat in the plugin folder and run from cmd but I had the follow error:

"C:\PROGRA~1\QGIS" is not recognized as an internal or external command,  an executable program or batch file.

I also follow this suggestion and substituted the content of compile file with this:

@ECHO OFF

set OSGEO4W_ROOT="C:\Program Files\QGIS 3.4"

set PATH=%OSGEO4W_ROOT%\bin;%PATH%
set PATH=%PATH%;%OSGEO4W_ROOT%\apps\qgis\bin

@echo off
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
call "%OSGEO4W_ROOT%\bin\qt5_env.bat"
call "%OSGEO4W_ROOT%\bin\py3_env.bat"
@echo off
path %OSGEO4W_ROOT%\apps\qgis-dev\bin;%OSGEO4W_ROOT%\apps\grass\grass-7.2.2\lib;%OSGEO4W_ROOT%\apps\grass\grass-7.2.2\bin;%PATH%

cd /d %~dp0

@ECHO ON
::Ui Compilation
call pyuic5 save_attribute_dialog.ui --from-imports -o save_attribute_dialog.py          

::Resources
call pyrcc5 ui\resources.qrc -o gui\generated\resources_rc.py

@ECHO OFF
GOTO END

:ERROR
   echo "Failed!"
   set ERRORLEVEL=%ERRORLEVEL%
   pause

:END
@ECHO ON

But I have the same error. How do I solve it?

8
  • Try to double click compile.bat in the plugin folder and it should create pyrcc5.
    – ahmadhanb
    Apr 5, 2019 at 2:09
  • I copied save_attribute folder in C:\Users\...\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ , run both the compile.bat file but I have the same error.
    – PaolaB
    Apr 5, 2019 at 7:23
  • Did you download QGIS using OSGeo4W or as a stand alone exe file?
    – ahmadhanb
    Apr 5, 2019 at 7:38
  • The stand alone exe file
    – PaolaB
    Apr 5, 2019 at 8:02
  • Then use the first batch file in your question and put it in the plugin folder and double click and it should create pyrcc5. However, make sure that you are using QGIS version of 3.4. If you are using different version like 3.6, you need to change QGIS 3.4 in all the paths in the batch file to QGIS 3.6.
    – ahmadhanb
    Apr 5, 2019 at 8:14

2 Answers 2

3

I had the same issue. As you said in the your comment putting the path inside the pyrcc5.bat file between quotes solved it. The reason for that is the main folder of QGIS 3.xx has a space inside its name by default (in my case it was this: C:\Program Files\QGIS 3.8\apps\Python37), thats why the .bat gets stuck at C:\PROGRA~1\QGIS. Hope this helps anyone with similiar issue.

1
  • Hi and welcome to GIS.SE! Please paraphrase your comment with great detail in order to make it an answer. Otherwise please post it into the comment section.
    – root676
    Sep 18, 2019 at 9:14
0

Removing e from the last word works for me

pyrcc5.bat -o resources.py resources.qrce 

Remove e --->

pyrcc5.bat -o resources.py resources.qrc

Your Answer

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

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