Bug report #10783

[Processing] ParameterString return "None" as unicode

Added by Etienne Trimaille almost 10 years ago. Updated almost 9 years ago.

Assignee:Victor Olaya
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 ?


#1 Updated by Victor Olaya almost 10 years ago

  • Status changed from Open to Feedback

can you provide an example of a model where you have that problem? I do not understand what the issue is exactly


#2 Updated by Etienne Trimaille almost 10 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.

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 "".

#3 Updated by Victor Olaya almost 10 years ago

hmm, I do not undertand how you use the modeler and python code at the same time... Could you add the model itself and the script to the issue?


#4 Updated by Etienne Trimaille over 9 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.

#5 Updated by Etienne Trimaille over 9 years ago

  • Status changed from Feedback to Closed

I updated my plugin to processing 2.5.
This bug seems to be solved, now I get :


#6 Updated by Giovanni Manghi almost 9 years ago

  • Category changed from 94 to Processing/Core

Also available in: Atom PDF