GH Python-3 Editor: Error with ghpythonlib curve operations?

Using ghpythonlib.components within the new Python3 editor in Grasshopper. Running the code:

import ghpythonlib.components as ghc
a = ghc.ControlPoints(x).points

on a single Polyline. In old GHPython component it works, In new IronPython component it works, but in Python3 component it fails with the TypeError ?

Traceback (most recent call last):
File “rhinocode:///grasshopper/1/bb3c85fc-075c-479b-b881-011913859fac/6ed762a7-d56d-47de-b86d-11dae4f305a4”, line 2, in
File “/Users/em/.rhinocode/py39-rh8/site-rhinoghpython/ghpythonlib/components.py”, line 164, in component_function
elif len(result) > 1: result = __namedtuple(outputnames, result)
File “/Users/em/.rhinocode/py39-rh8/site-rhinoghpython/ghpythonlib/components.py”, line 62, in init
raise TypeError(
TypeError: Expected type Array[str] for input ‘attributes’, got IReadOnlyList[String].`


Environment:

  • Macbook 2021, Apple M1 Max
  • macOS 13.6.1 (Ventura)
  • Rhino Version 8 (8.4.24030.15002, 2024-01-30)

example file attached for reference.
example.gh (13.5 KB)


all the best,
@ed.p.may

1 Like

I would like to report that I’m having a same issue on Rhino 8.4. Using the new Python 3 script editor on Windows 11.

There was a similar issue at the link below

Would using ghpythonlib components in Python 3 editor be possible someday?

They’re definitely supported. We have a few bugs now that we are working on. Ticket is directly related to the problem you are seeing:

RH-80651 Pythonnet custom Enumerable does not find python methods

1 Like

Could you please elaborate on how can I use numpy and ghpythonlib.components in Rhino 8, Grasshopper?
I want to write an algorithm to create the kinematic matrix of a structure and I have to use the numpy library. On the other hand, I use points and lines as variables, and I should use gh components in my code.

You can specify numpy like this in your script and the editor will handle installing the package

# requirements: numpy
import numpy

It successfully works.

Thank you.

1 Like