BUG - Beta - Python 3 - Script Component - None Returning As String


I often use “None” to output a null value in Python.

However, in the new script editor it is outputting as its string representation “None”

If I set the type hint on the output to float then I get the proper null i expect (because the float didn’t know how to convert the None text…) but I get the error:

  1. Parameter “Value (V)” type conversion failed from Goo to float

My question is, if my output list is the result of summated numbers why am I getting it returned as a string? Also, either way, if I say “make this item None” shouldn’t it return regardless of it being a float, string, or anything unless I explicitly cast it to string such as: a = str(None)

I’m confused, is this a bug or user error?

Here’s the snip from the code trying to handle the None condition:

def Convert_To_Model_Units(V):
    converted_values = []

    for value in V:
        if value:
            parsed_values = Parse_String(value)
            unit_systems = Get_Unit_System(parsed_values)
            converted_value = Convert_Units(parsed_values, unit_systems)
    return converted_values

Thanks for the help!

It definitely should not return a “None” string instead of None. It must be related to the collection converter on the output as setting None constant on the output of a that is hinted as float returns <null> here

What does Parse_String do in that method? Would you mind sharing a definition with the error?

1 Like

I’ve had a similar problem yesterday and I think the problem lies in the append…

append_none.gh (16.9 KB)

Ended up replacing the append with break and it worked for me.

1 Like

That looks to be correct, thanks Martin.

Repeatable here:

test = None

a = test
test = []


a = test

1 Like

Uh on…Okay I’ll look into it. Thanks for catching this

For Reference: RH-77705 None in python list in Grasshopper is being output as string “None”


Thanks @eirannejad , looks good on my end after the latest build!

1 Like