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

Stephen posting at vodacomm.ca
Mon May 28 00:51:28 PDT 2018


Hi Nyall,

sorry, I've made it past this error -- did you see this post?

http://lists.osgeo.org/pipermail/qgis-user/2018-May/042461.html

On 28.05.2018 07:07, Nyall Dawson wrote:
> 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.

I have observed that sometimes, when using temp files generated by
processing, QGIS (or the underlying algorithm) will not detect the file,
even though it exists.

I need to test this to confirm or falsify your theory. I'll let you know
what I find.

> 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).

Sadly, no, this is purely standalone code (the wisdom of this is
arguable, but here we are).

How can I turn on detailed logging in standalone PyQGIS?

Thanks

Stephen



More information about the Qgis-user mailing list