GPStringHidden not working in python toolbox

2394
3
06-30-2014 12:51 AM
antoniogomez
New Contributor
Helloo Forum

I'm testing the GPStringHidden datatype in a 10.2.0  python toolbox.
Just a simply test: creating a GPStringHidden parameter and showing with arcpy.AddMessage the string the user entered when running the python toolbox tool

My parameters info section looks like this:


p0 = arcpy.Parameter(
displayName="Testing a hidden string",
name="strhid1",
datatype="GPStringHidden",
parameterType="Required",
direction="Input")


params = [p0]
return params


And my execute section just like tthis

arcpy.AddMessage(parameters[0].value)



And it seems that the datatype is not recognized, because I get the error:


Traceback (most recent call last):
  File "<string>", line 30, in getParameterInfo
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\mixins.py", line 286, in __init__
    setattr(self, attrib, attribvalue)
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\_base.py", line 89, in _set
    return setattr(self._arc_object, attr_name, cval(val))
ValueError: ParameterObject: Invalid input value for DataType property


Has anybody experienced the same?

Thanks in advanced

Antonio
Tags (2)
0 Kudos
3 Replies
KevinHibma
Esri Regular Contributor
Very close, try this

        myPassword = arcpy.Parameter(
            displayName="Hide this!",
            name="hide_password", 
            datatype="String Hidden",
            parameterType="Required",
            direction="Input")


.....also note, this is new at 10.2.2 (it is not available at 10.2.0)
0 Kudos
antoniogomez
New Contributor

Thanks, Kevin

I´m at 10.2.0 version now. I´ll upgrade to 10.2.2 and try it.

I took a look at documentation ArcGIS Help (10.2, 10.2.1, and 10.2.2) and I thought it was possible to use gpstringhidden at 10.2.0‌

0 Kudos
KevinHibma
Esri Regular Contributor

Antonio,

We'll meet in the middle

I just looked up when we installed it, and it seems we installed it at 10.2.1, not 10.2.2 like I thought.

0 Kudos