Skip to content
Permalink
Browse files

processing.run requires a dictionary for parameters

  • Loading branch information
nyalldawson committed Jun 27, 2017
1 parent 792a252 commit 2a1cdead51c63ead0c210999f028ea7c8121e09d
Showing with 2 additions and 32 deletions.
  1. +2 −32 python/plugins/processing/core/Processing.py
@@ -39,7 +39,7 @@
from qgis.core import (QgsMessageLog,
QgsApplication,
QgsProcessingProvider,
QgsProcessingUtils,
QgsProcessingAlgorithm,
QgsProcessingParameterDefinition)

import processing
@@ -123,7 +123,7 @@ def removeScripts(folder):

@staticmethod
def runAlgorithm(algOrName, onFinish, *args, **kwargs):
if isinstance(algOrName, GeoAlgorithm):
if isinstance(algOrName, QgsProcessingAlgorithm):
alg = algOrName
else:
alg = QgsApplication.processingRegistry().algorithmById(algOrName)
@@ -164,36 +164,6 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
Processing.tr('Error: Missing parameter value for parameter {0}.').format(param.name()),
Processing.tr("Processing"))
return
else:
if len(args) != alg.countVisibleParameters():
# fix_print_with_import
print('Error: Wrong number of parameters')
QgsMessageLog.logMessage(Processing.tr('Error: Wrong number of parameters'),
Processing.tr("Processing"))
processing.algorithmHelp(algOrName)
return
i = 0
for param in alg.parameterDefinitions():
if not param.flags() & QgsProcessingParameterDefinition.FlagHidden:
if not True: # TODO param.setValue(args[i]):
# fix_print_with_import
print('Error: Wrong parameter value: ' + str(args[i]))
QgsMessageLog.logMessage(Processing.tr('Error: Wrong parameter value: ') + str(args[i]),
Processing.tr("Processing"))
return
else:
parameters[param.name()] = args[i]
i = i + 1

for output in alg.outputs:
if not output.flags() & QgsProcessingParameterDefinition.FlagHidden:
if not output.setValue(args[i]):
# fix_print_with_import
print('Error: Wrong output value: ' + str(args[i]))
QgsMessageLog.logMessage(Processing.tr('Error: Wrong output value: ') + str(args[i]),
Processing.tr("Processing"))
return
i = i + 1

feedback = None
if kwargs is not None and "feedback" in list(kwargs.keys()):

0 comments on commit 2a1cdea

Please sign in to comment.
You can’t perform that action at this time.