Bug report #18898

Problem using processing dissolve from pyqgis

Added by José Miguel Pascual over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/QGIS
Affected QGIS version:3.0.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:26730

Description

Hi,

I'm trying to dissolve district polygons to state level using pyqgis. The code worked well in a previous version of qgis 3 (I think 3.0.0) but know the following errors appears: NameError: name 'QgsProcessingFeedback' is not defined

Here is the code and error:

processing.runAndLoadResults("native:dissolve", {'INPUT':layer_district,
                                                 'FIELD':['STATENAME'],
                                                 'OUTPUT':'memory:'})
Traceback (most recent call last):
  File "C:\OSGEO4~1\apps\Python36\lib\code.py", line 91, in runcode
    exec(code, self.locals)
  File "<input>", line 3, in <module>
  File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\tools\general.py", line 109, in runAndLoadResults
    return Processing.runAlgorithm(alg, parameters=parameters, onFinish=handleAlgorithmResults, feedback=feedback, context=context)
  File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\core\Processing.py", line 119, in runAlgorithm
    feedback = QgsProcessingFeedback()
NameError: name 'QgsProcessingFeedback' is not defined

History

#1 Updated by Nyall Dawson over 6 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

This was fixed by 78484c10a0e9609b5300d3cb7929e7acd71c3d6c.

Until 3.0.3 the solution is to modify your processing.run call:

    processing.runAndLoadResults("native:dissolve", {'INPUT':layer_district,
        'FIELD':['STATENAME'],
        'OUTPUT':'memory:'}, feedback = QgsProcessingFeedback() )

#2 Updated by Jürgen Fischer over 6 years ago

  • Description updated (diff)

Also available in: Atom PDF