I'm trying to build a launch.bat for qgis 3 python. I would want to run python via batch file but I get an error 'no module named processing'
Launch.bat:
@ECHO OFF
set OSGEO4W_ROOT=C:\OSGeo4W64
@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\bin;%PATH%
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis
set GDAL_FILENAME_IS_UTF8=YES
set VSI_CACHE=TRUE
set VSI_CACHE_SIZE=1000000
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt5\plugins
set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH%
python D:\Testi2\testi.py
pause
Is the problem within those CALL batch files?
I think the problem might be in the python file I'm trying to run:
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsProcessing,
QgsProcessingAlgorithm,
QgsProcessingException,
QgsProcessingOutputNumber,
QgsProcessingParameterDistance,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterVectorDestination,
QgsProcessingParameterRasterDestination)
import processing
etc.
I also tried adding..
# Prepare the environment
import sys
from qgis.core import QgsApplication
from PyQt5.QtGui import QApplication
app = QApplication([])
QgsApplication.setPrefixPath('C:\OSGeo4W64\bin', True)
QgsApplication.initQgis()
# Prepare processing framework
sys.path.append('C:\OSGeo4W64\apps\qgis\python\plugins')
from processing.core.Processing import Processing
Processing.initialize()
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsProcessing,
QgsProcessingAlgorithm,
QgsProcessingException,
QgsProcessingOutputNumber,
QgsProcessingParameterDistance,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterVectorDestination,
QgsProcessingParameterRasterDestination)
import processing
But it doesn't start qapplication via Pygt5.gtgui