[Qgis-user] How do I pass parameters to grass7 algorithms with Processing.run?

Nyall Dawson nyall.dawson at gmail.com
Sun May 27 22:07:54 PDT 2018


On 14 May 2018 at 19:30, Stephen <posting at vodacomm.ca> wrote:
>
> Automatically setting output paths to temporary files would be a
> sensible convenience, I think.
>
> In any event, I used processing.tools.system.getTempFilename() to set a
> filename and that gets me past the 'Incorrect parameter value for
> output' error.
>
> However, I am still getting "Unable to execute algorithm".
>
> In AlgorithmExecutor, line 55:
> results, ok = alg.run(parameters, context, feedback)
>
> returns ({}, False)
>
> parameters contains:
>
> {'GRASS_REGION_CELLSIZE_PARAMETER': 0.008333, 'use': 1,
> 'GRASS_REGION_PARAMETER':
> '33.91415594546105,41.91384412832699,-4.679722671256611,5.467319665842772',
> 'input': <qgis._core.QgsVectorLayer object at 0x7fdbbd02bc18>,
> 'GRASS_MIN_AREA_PARAMETER': 0.0001, 'GRASS_SNAP_TOLERANCE_PARAMETER':
> -1, 'type': 0, 'output':
> '/tmp/processing_da49d2e8c1bd4e249d1a5c6d42680149/5af9540a0b2212'}
>
> context contains:
>
> <qgis._core.QgsProcessingContext object at 0x7fdbbd04e3a8>
>
> and feedback contains:
>
> <qgis._core.QgsProcessingFeedback object at 0x7fdbbd02bee8>
>
> Without a useful error message, it's very difficult to troubleshoot this
> on my own.
>
> Do you have any idea what might be wrong here?

I had another look at this. I suspect what might be happening is that
'tmp/processing_da49d2e8c1bd4e249d1a5c6d42680149/5af9540a0b2212' does
not exist, which makes GRASS bomb out with a 'No such file or
directory' error.

Are you running this script from within QGIS itself? You should see
the detailed log, including all the output from grass, by opening the
log window and switching to the "Processing" tab (alternatively
running from a terminal window will also show this output on the
command line).

Nyall



More information about the Qgis-user mailing list