In my python script based on Qgis 3.0.3-Girona, the processing.run() is completely ignored. There are similar questions that are marked as duplicate - but those do not address or solve the issue that I list here. Here is my script.... *
from qgis.core import (
QgsApplication,
QgsProcessingFeedback,
QgsVectorLayer
)
from qgis.core import QgsApplication
# See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
qgs = QgsApplication([], False)
qgs.initQgis()
# Append the path where processing plugin can be found
sys.path.append('e:\\QGIS3\\apps\\qgis\\qtplugins')
sys.path.append('e:\\QGIS3\\apps/Qt5\\plugins')
sys.path.append('e:\\QGIS3\\apps\\qgis\\python\\plugins')
sys.path.append("e:\\QGIS3\\apps\\Python36\\Lib\\site-packages")
from processing.core.Processing import Processing
Processing.initialize()
print("Finished importing")
params = {
'INPUT_RASTER':'E:\\arp\\LEAP\\s823_actfilt.tif',
'RASTER_BAND':1,
'INPUT_VECTOR':'E:\\arp\\LEAP\\test.shp',
'COLUMN_PREFIX':'actfilt_',
'STATS':[0,1,2],
}
feedback = QgsProcessingFeedback()
print("Starting zonalstats")
processing.run("qgis:zonalstatistics", params,feedback)
print("Finished zonalstats")
* The output prints "Starting zonalstats" ; "Finished importing" but never prints "Finished zonalstats". I tried several combinations including capturing the output to res variable etc. (as explained in other similar posts) but none of them work - the processing.run() is simply ignored. Not sure if it is a bug or something I'm doing wrong.