Bug report #10783
[Processing] ParameterString return "None" as unicode
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||19164|
In the modeler, ParameterString return a "None" value as unicode, not as NoneType.
I guess you want to return an empty unicode, no ?
I think an "else" is missing line 51 in ParameterString.py, isn't it ?
#2 Updated by Etienne Trimaille over 7 years ago
This my code :
def processAlgorithm(self, progress): value = self.getParameterValue(self.WHITE_LIST[layer]) print value print len(value) print value.__class__.__name__
self.WHITE_LIST[layer] is a ParameterString which is defined by a PARAMETER_STRING (ModelerParameterDefinitionDialog) in the modeler.
None 4 unicode
However, if I let the parameterString empty in the algorithm (I deleted the block PARAMETER_STRING in the modeler), I will get the right empty value "".
#4 Updated by Etienne Trimaille over 7 years ago
This code is in my own algo in python, that's why I can test python code in the modeler.
Today, even if I put or not a ModelerParameterDefinitionDialog, I have a "None" value as unicode.