Skip to content
Browse files
[processing] Use silent feedback by default in
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
  • Loading branch information
nyalldawson committed Apr 10, 2018
1 parent bf0c4f9 commit d5573a5a7bf5a32490b50f528da10c6f58871eab
Showing 1 changed file with 1 addition and 1 deletion.
@@ -116,7 +116,7 @@ def runAlgorithm(algOrName, parameters, onFinish=None, feedback=None, context=No
alg = QgsApplication.processingRegistry().createAlgorithmById(algOrName)

if feedback is None:
feedback = MessageBarProgress(alg.displayName() if alg else'Processing'))
feedback = QgsProcessingFeedback()

if alg is None:
# fix_print_with_import

1 comment on commit d5573a5

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the import missing ?

I've got name 'QgsProcessingFeedback' is not defined when my plugin calls r.cost through
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\", line 83, in runCost
    raise e
  File "C:/Users/mathieu.chailloux/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ecologicalcontinuity\", line 79, in runCost"grass7:r.cost",parameters)
  File "C:/TMP_OS\~1/apps/qgis-dev/./python/plugins\processing\tools\", line 84, in run
    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
  File "C:/TMP_OS\~1/apps/qgis-dev/./python/plugins\processing\core\", line 119, in runAlgorithm
    feedback = QgsProcessingFeedback()
NameError: name 'QgsProcessingFeedback' is not defined

Best regards,

Please sign in to comment.