In the discussion from a question I asked several days ago (Using the processing framework in a PyQGIS standalone application), someone suggested that I use general.runalg() instead of processing.runalg() for running QGIS algorithms.
I've now used both, and haven't noticed a difference in either performance or syntax between them. I'm just wondering what sort of differences there are between these two methods, and which one I should be using.
Best Answer
Open a QGIS Python Console and run this:
You will get:
Which indicates us that by using
processing.runalg()
, you're actually callinggeneral.runalg()
.Note that if you want to call
general.runalg()
explicitly, you need to import thegeneral
module fromprocessing.tools
.In summary, use whatever you want, just make sure you initialize Processing (
Processing.initialize()
) before callingrunalg()
if you're running a standalone PyQGIS script.