[BUG?] New Script Editor doesn't expose Value for input parameter

Hi @eirannejad, I’ve noticed an issue with the way the Value attribute of an input parameter is exposed to the new Script Editor in Python

Consider this code:

t_input = [i for i in ghenv.Component.Params.Input if i.Name == "T"][0]
t_input_toggle = t_input.Sources[0]
print(hasattr(t_input_toggle, "Value"))

Output with the old GHPython editor:

<Grasshopper.Kernel.Special.GH_BooleanToggle object at 0x000000000000002B [Grasshopper.Kernel.Special.GH_BooleanToggle]>

Output with the new Python editor:


This works as expected with the new C# editor:

private void RunScript(bool T)
    var tInputParam = Component.Params.Input.Find(p => p.Name == "T");        
    var tInputSource = tInputParam.Sources[0];
    var hasValueProperty = tInputSource.GetType().GetProperty("Value") != null;



GH file: unnamed.gh (13.1 KB)

I’m on Version 8 SR6 (8.6.24101.5001, 2024-04-10)

Upgrade to the lastest 8.7x. I’ve not tried it with param Values, but Grasshopper component attribute support was added after 8.6

You’re right, it works now. Thanks!

1 Like

Actually, it half-works, since the value is read-only (just tried it). So there is still no parity with respect to the old behavior.

Ah. Even in an Iron Python 2 component?

No, it works as expected in an Iron Python 2 component. This is an issue with Python 3 only.

I realize the title of this topic is ambiguous as it seems to imply the Script Editor causes the issue.


I am testing this under 8.8 and seems to be Ok. I’ll add a test to my unit tests

Accessing the Value attribute works on SR7 also, but not setting it. My previous file didn’t cover this case.

Can you test the following file on SR8?

unnamed.gh (5.1 KB)

Expected behavior: the Boolean Toggle should return to False as soon as it is set to True.

Behavior with IronPython 2 Script : works as expected

(in Grasshopper, the Panel text flashes shortly to True, but this is not visible in the GIF)

Behavior with Python 3 Script : the state of the Boolean Toggle is not modified; the line t_input_toggle.Value = False has no effect.


So weird :thinking:

Somehow the t_input_toggle.Value = False line has no effect!!! and it throw GH into solving the solution forever since boolean toggle never becomes False


Found the problem and putting a fix for Rhino 8.9 RC

RH-82012 Interface wrapped object can not set value

1 Like

Great that you found a fix! Looking forward to SR 8.9 then :slight_smile:

1 Like