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?
Best Answer
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.