[QGIS-Developer] GRASS r.kappa not working in QGIS plugin

Nyall Dawson nyall.dawson at gmail.com
Wed Aug 8 23:40:22 PDT 2018


On Mon, 6 Aug 2018 at 17:38, Sophie Crommelinck
<sophie.crommelinck at gmail.com> wrote:
>
> I just noted that everything works fine, when the module r.kappa is run once manually via the toolbox in QGIS before running the plugin. When I open QGIS (I am using the latest QGIS 3.3.0 nightly build version) and run the plugin directly, the GRASS module r.kappa in the plugin doesn't work. When I open QGIS, run r.kappa via the toolbox and run the plugin then, the GRASS module r.kappa in the plugin works fine. Not sure how to fix this.
>
> Best,
> Sophie
>
> On Mon, 6 Aug 2018 at 08:10, Sophie Crommelinck <sophie.crommelinck at gmail.com> wrote:
>>
>> Hello,
>>
>>
>> I am working on a QGIS plugin, that should use the module r.kappa from GRASS. It looks like this in my plugin source code:
>>
>> processing.run('grass7:r.kappa',
>>                {"classification": classificationLayer,
>>                 "reference": referenceLayer,
>>                 "title": 'ACCURACY ASSESSMENT',
>>                 "-h": False,
>>                 "-w": False,
>>                 "GRASS_REGION_CELLSIZE_PARAMETER": cellSize,
>>                 "GRASS_REGION_PARAMETER": None,
>>                 "output": outputFile})
>>
>> As an error, I get a QgsProcessingException saying 'There were errors executing the algorithm'.

Can you try putting somewhere near the start of your script:

from processing.algs.grass7.Grass7Utils import Grass7Utils
assert Grass7Utils.installedVersion()

And see if the assert passes, and whether that fixes your issue?

Nyall


More information about the QGIS-Developer mailing list