DataTree not working in Mac GhPython

mac
ghpython
python
ironpython

(qythium) #1

Trying to instantiate a DataTree in the Python component on Mac produces a cryptic error:

tree = DataTree[object]()

Runtime error (MissingMemberException): 'type' object has no attribute '__index__'

The exact same code works in the Windows R5 version of Grasshopper and ghPython, and in the equivalent C# version on both platforms.

I’ve uploaded a test gh definition which constructs a tree with 2 items:

datatree_test.gh (4.5 KB)


#2

it works for me:

??


(qythium) #3

That’s really odd, I did a little more testing and found out that it seems to apply to all strongly-typed .NET -style classes like System.Array and Collections.Generic.List, which take a square-bracket type-identifier in their constructor (not sure what the proper term is)

So doing something like

a = System.Array[int]([1,2,3]) 

also produces the exact same error as above… so it might be a Mono / IronPython specific issue?

I’m running the latest version of Rhino 5.4 WIP (5E397w) on Mac OS 10.13.13 High Sierra, with several other installations of Python on my system.
Is anyone else able to reproduce this?


#4

that also works for me:


there have been a few other threads over the years where people have installed other Pythons on Mac and end up having problems with Rhino.

on my end, i have:

Rhino 5E397W
macOS 10.13.3
standard macOS install of Python which is 2.7.10


(qythium) #5

Update: I did a full purge and reinstall of Rhino, and that seems to have solved the issue - above commands are now working as expected :slight_smile:.
@jeff_hammond thanks for the help!