I'm trying to run a script that loops through a series of point layers and interpolates using the TIN interpollation method using python on QGIS. The script worked in the past, but now it fails with the following error:

NameError: name 'QgsProcessingFeedback' is not defined

import qgis.analysis
import qgis.core
import processing
import os
import fnmatch
from qgis.core import QgsProcessingFeedback #added based on [post 194737][1]

use_cols = [6,9,10,11]
col_names = ["Depth","Velocity","Froude","Stress"]
source_geopackage = "D:/GIS/TRF2/PC3_hydropts.gpkg"
interim_path = "D:/GIS/TRF2/Raster_output/"
export_path = "D:/GIS/TRF2/PC3_rasters/"
layers = qgis.utils.iface.mapCanvas().layers() #using canvas layers
for layer in layers:
layerType = layer.type()
if layerType == QgsMapLayer.VectorLayer:
    for i in range(0,len(use_cols)):
        col = use_cols[i]
        output_file_name = layer.name()+"_"+col_names[i]
        export_file_name = interim_path + output_file_name+".tif"
        vlayer = source_geopackage+"|layername="+layer.name()+"::~::0::~::"+str(col)+"::~::0"
        processing.run("qgis:tininterpolation", {
        'EXTENT':'1793310.0,1801470.0,498942.0,501991.0 [EPSG:2285]',
        'OUTPUT': export_file_name})

Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\code.py", line 91, in runcode exec(code, self.locals) File "", line 13, in File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\tools\general.py", line 84, in run return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context) File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\core\Processing.py", line 119, in runAlgorithm feedback = QgsProcessingFeedback() NameError: name 'QgsProcessingFeedback' is not defined

I'm running QGIS v3.0.2 on Windows, and accessing Python through the QGIS console.

When I wrote the loop, I ran TIN interpolation through the processing framework and copied the settings from the history. I tried to repeat that process, but I get the same error. The algorithm runs fine through processing.

1 Answer 1


Add feedback = QgsProcessingFeedback() as a parameter for processing.run():

feedback = QgsProcessingFeedback() # I'd put this out of any for loops

processing.run("qgis:tininterpolation", {
        'EXTENT':'1793310.0,1801470.0,498942.0,501991.0 [EPSG:2285]',
        'OUTPUT': export_file_name
  • What is this line doing? It worked smoothly, and there was another place later in the script where I needed to add it again. Any idea why the script ran fine a month ago (with a different set of files) but fails now? Commented Jun 8, 2018 at 13:37
  • 1
    Yeah, that feedback parameter became mandatory for a while, don't know why. But testing against current dev version such parameter seems to be optional again. Commented Jun 8, 2018 at 14:35

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.