Skip to content

Commit d5573a5

Browse files
committedApr 10, 2018
[processing] Use silent feedback by default in processing.run
Relying on the iface messagebar feedback as a fallback is not safe for standalone scripts. If callers want to use a message bar feedback they should specify this feedback object specifically when calling processing.run
1 parent bf0c4f9 commit d5573a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎python/plugins/processing/core/Processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def runAlgorithm(algOrName, parameters, onFinish=None, feedback=None, context=No
116116
alg = QgsApplication.processingRegistry().createAlgorithmById(algOrName)
117117

118118
if feedback is None:
119-
feedback = MessageBarProgress(alg.displayName() if alg else Processing.tr('Processing'))
119+
feedback = QgsProcessingFeedback()
120120

121121
if alg is None:
122122
# fix_print_with_import

1 commit comments

Comments
 (1)

MathieuChailloux commented on Apr 17, 2018

@MathieuChailloux

Isn't the import missing ?

I've got name 'QgsProcessingFeedback' is not defined when my plugin calls r.cost through processing.run.
The error disappears when importing QgsProcessingFeedback.

Here is the full stacktrace

Traceback (most recent call last):
  File "C:/Users/mathieu.chailloux/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ecologicalcontinuity\eco_cont_dialog.py", line 83, in runCost
    raise e
  File "C:/Users/mathieu.chailloux/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ecologicalcontinuity\eco_cont_dialog.py", line 79, in runCost
    processing.run("grass7:r.cost",parameters)
  File "C:/TMP_OS\~1/apps/qgis-dev/./python/plugins\processing\tools\general.py", line 84, in run
    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
  File "C:/TMP_OS\~1/apps/qgis-dev/./python/plugins\processing\core\Processing.py", line 119, in runAlgorithm
    feedback = QgsProcessingFeedback()
NameError: name 'QgsProcessingFeedback' is not defined

Best regards,
Mathieu

Please sign in to comment.