Bug report #21116

processing.run and processing.runAndLoadResults give different output

Added by Etienne Trimaille about 5 years ago. Updated about 5 years ago.

Affected QGIS version:3.5(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:28934


I noticed that "processing.run" and "processing.runAndLoadResults" give different output.

The first one returns a dictionary of QgsMapLayer object. The second one returns a dictionary of maplayer ID.

This is IMHO not very convenient when you develop a script, calling many sub Processing algorithm. Sometimes you want to debug quickly by checking the content of an intermediate result by adding "AndLoadResults". But then the output is different, so the script fails with an "AttributeError" if the function doesn't exist on the new returned object.

I'm not sure if it's a bug or if it was a feature.


#1 Updated by Alexander Bruy about 5 years ago

This is no bug, runAndLoadResults() performs some actions after algorithm execution (applying style, loading layer into project, etc) and as result removes layers from the context's layer store.

This always worked in the same way.

#2 Updated by Nyall Dawson about 5 years ago

  • Resolution set to wontfix
  • Status changed from Open to Rejected


Also available in: Atom PDF