From f03baa871aa313dedf45a6cd65c0c40466f095b6 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 9 Apr 2018 14:32:59 +1000 Subject: [PATCH] [processing][grass] Don't try to create skipped optional outputs --- .../plugins/processing/algs/grass7/Grass7Algorithm.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/plugins/processing/algs/grass7/Grass7Algorithm.py b/python/plugins/processing/algs/grass7/Grass7Algorithm.py index d6bcb3cec32..6dbdaeb6cbe 100644 --- a/python/plugins/processing/algs/grass7/Grass7Algorithm.py +++ b/python/plugins/processing/algs/grass7/Grass7Algorithm.py @@ -637,6 +637,10 @@ class Grass7Algorithm(QgsProcessingAlgorithm): for out in self.destinationParameterDefinitions(): outName = out.name() + if not outName in parameters: + # skipped output + continue + if isinstance(out, QgsProcessingParameterRasterDestination): self.exportRasterLayerFromParameter(outName, parameters, context) elif isinstance(out, QgsProcessingParameterVectorDestination): @@ -688,8 +692,11 @@ class Grass7Algorithm(QgsProcessingAlgorithm): :param context: Algorithm context. :param colorTable: preserve color Table. """ - fileName = os.path.normpath( - self.parameterAsOutputLayer(parameters, name, context)) + fileName = self.parameterAsOutputLayer(parameters, name, context) + if not fileName: + return + + fileName = os.path.normpath(fileName) grassName = '{}{}'.format(name, self.uniqueSuffix) outFormat = Grass7Utils.getRasterFormatFromFilename(fileName) createOpt = self.parameterAsString(parameters, self.GRASS_RASTER_FORMAT_OPT, context)