Are ghpythonlib.components available in WIP in python 3?

Hi I am updating some older Rhino 7 grasshopper code to python 3.9 in Rhino 8 WIP to take advantage of libraries such as networkx an numpy.

I have come across and error in porting code which refers to the gh components in ghpythonlib.components

This code worked for me previously:

import ghpythonlib.components as ghcomp

crv_copy = ghcomp.ExtendCurve(crv_copy, 0, new_ext, new_ext)

now I get this error in my python 3 component in grasshopper:

File “C:\Users\brian.rhinocode\python3.9-31\site-rhinoghpython\ghpythonlib\components.py”, line 150, in component_function
result, warnings = info.Evaluate(args, keep_tree)
TypeError: No method matches given arguments for ComponentFunctionInfoImplementation.Evaluate: (<class ‘tuple’>, <class ‘bool’>)

Does anybody have any suggestions at all?

Many thanks,

Brian

@brian9 I also see that. I made a new bug report for this, tracked here: RH-76559 ScriptEditor Python 3.9: ghpythonlib.components do not work

2 Likes

Having the same problem with other functions of ghpythonlib.components from within Python3…

1 Like

Hi sorry for not responding to this thread I’ve had an extended hiatus on the project I was porting to Rhino8 WIP. I have found another very similar error in using ghcomp:

.rhinocode\py39-rh8\site-rhinoghpython\ghpythonlib\components.py", line 163, in component_function
elif len(result) > 1: result = __namedtuple(outputnames, result)
File “C:\Users\brian.rhinocode\py39-rh8\site-rhinoghpython\ghpythonlib\components.py”, line 61, in init
raise TypeError(
TypeError: Expected type Array[str] for input ‘attributes’, got IReadOnlyList[String].

code that caused this:
import ghpythonlib.components as ghcomp

paired_crv, flag = ghcomp.FlipCurve(paired_crv, crv)

This is in 5/10/23 update of grasshopper

1 Like

actually, sorry it’s 1.0.0007 from Friday 13/10/23 and I’m finding this with any ghcomp call eg.

geom, transf = ghcomp.Move(move_crv, move_vec )

I appreciate that in hindsight I should have done everything in rhinocommon, but it was easier to quickly work with the gh components I already new and now I have a big code maintenance problem and re-write on my hands if ghcomp isn’t going to be a feature going forward