[Qgis-user] QGIS 3 : Run alg in an algorithm
Nyall Dawson
nyall.dawson at gmail.com
Sun Apr 8 16:20:39 PDT 2018
On 9 April 2018 at 06:23, Jean-Baptiste Desbas <jb.desbas at gmail.com> wrote:
> Hello,
>
> I wan't to run a native algorithm (execute SQL) in an homemade algorithm :
> I try
> processing.run('qgis:executesql',{'INPUT_DATASOURCES':[sink],'INPUT_QUERY':'SELECT
> * FROM input1'},feedback=None)
>
> but i've got an error :
>
> line 140, in processAlgorithm
> a=processing.run('qgis:executesql',{'INPUT_DATASOURCES':[sink],'INPUT_QUERY':'SELECT
> * FROM input1'},feedback=None)
> File "/usr/share/qgis/python/plugins/processing/tools/general.py", line 84,
> in run
> return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback,
> context)
> File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line
> 135, in runAlgorithm
> feedback.reportError(msg)
> TypeError: reportError() missing 1 required positional argument:
> 'fatal_error'
>
Thanks, fixed in https://github.com/qgis/QGIS/commit/ccccad54c0
Note that you should be passing on the feedback object from
processAlgorithm to this sub-algorithm, or you'll lose progress
reports, cancelation support and feedback messages sent from the sub
algorithm.
E.g.
processing.run('qgis:executesql',{'INPUT_DATASOURCES':[sink],'INPUT_QUERY':'SELECT
* FROM input1'},feedback=feedback)
That will also avoid the error on QGIS < 3.0.2
Nyall
>
> how can I do that ?
>
> Thanks,
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
More information about the Qgis-user
mailing list