Bug report #21116

processing.run and processing.runAndLoadResults give different output

Added by Etienne Trimaille about 1 year ago. Updated about 1 year ago.

Status:Rejected
Priority:Normal
Assignee:-
Category:Processing/Core
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

Description

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.

History

#1 Updated by Alexander Bruy about 1 year 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 1 year ago

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

#

Also available in: Atom PDF