[QGIS-Developer] Raster Calculator troubles in Processing with pyqgis

matteo matteo.ghetta at gmail.com
Tue Mar 12 00:13:34 PDT 2019


Hi devs,

I'm facing a really strange bug (IMHO). Same script, same project, same
data, same QGIS version (3.6), but different platform (linux vs windows).

The EXPRESSION parameter is giving errors when used, ONLY in Windows.

This is the small snippet I'm using without any problem in Linux:

param_calculated = {
	'EXPRESSION':'{}@1 * {}'.format(proximity['OUTPUT'], formula),
	'LAYERS': proximity['OUTPUT'],
	'OUTPUT': os.path.join(output, 'calcolato.tif')
}

calculated = processing.run("qgis:rastercalculator", param_calculated)

The exact same script is giving an error in Windows (not verbose error,
just saying processing.run is not running).

I discovered that, if I load the raster(s) into the TOC and user
my_raster.name() instead of the complete path (proximity['OUTPUT']) then
it seems working.

Is this a known bug/problem?

Cheers and thanks

Matteo


More information about the QGIS-Developer mailing list