Error converting IEnumerable to object using ghpythonlib.components

Im trying to create a script that can optimize a FE-Model using python within grasshopper. When using my normal script from IronPython it goes well up until the output needs to be converted to a object, i get the following error:

Rhino.Runtime.Code.Execution.ParamConvertException: Parameter “result_out” type conversion failed from IEnumerable____namedtuple to object
at Rhino.Runtime.Code.Execution.ParamValue.ConvertValue(ConvertDirection direction, Boolean resetOnError, String name)
at Rhino.Runtime.Code.Execution.ParamValueSet.Convert()
at Rhino.Runtime.Code.Code.ExecTry(RunContext context, IPlatformDocument& doc, Object& docState)
at Rhino.Runtime.Code.Code.Run(RunContext context)

If i print the variable it gives me the following:
ghpythonlib.components.System.Object__System.Collections.IEnumerable____namedtuple

If i run it in a IronPython enviroment it works without any problems. Am i doing anything wrong in Python 3?

1 Like

TLDR: Upgrade rhino version.

I had this exact error and was happy to find a single result on Google.

But my colleague did not have the same problem which led us to search for any differences, python environment, versions etc. But the only difference we could find was that he was using 8.7.24113.23001, 2024-04-22 and I 8.6.24101.5001, 2024-04-10. Updating rhino solved this issue.

Thank you Alexander, worked like a charm.