GH Python component not interpreting code

grasshopper
python

#1

Hello,

I’m using the most recent Rhino WIP for Mac, trying to learn scripting with GH Python.

When I open a Python component in GH, the script editor is behaving like a general text editor devoid of any scripting functionality… none of my code is highlighting, the lines aren’t numbered, there is no option to test code, etc. Moreover, there is no sign that any code is being executed in my Rhino window.

What is going on? Is there any component that I need to download off the internet in order for the built-in Python component to function? As far is I could find, everything I need should be built into the Mac WIP’s Grasshopper plug-in

-Anthony


#2

That’s just the way it is currently. There are no real script editor functions nor any highlighting etc.; and currently the Mac version of the python component also lacks the “Test” button that its Windows counterpart has…

However it should work, to test, write a=x+y in the component, then connect two numbers to the x and y inputs and a panel component to the a output and see if you get the correct sum… Here it works.

Edit:
And simply to add - it’s not clear if you already know some python scripting and just want to set things up in GH, or if you are just starting to learn scripting period… In the first case, I can’t help you much, but in the second case, I would always suggest learning scripting outside of Grasshopper first. You will have a much better understanding of how scripting in general works as well as the specifics of python.

There again, the Mac Rhino side is not set up as well as the Windows side currently, there is no built-in Python script editor, so you have to install and link an external editor - Atom is the current best candidate. Here are instructions for setting that up. There at least you will have syntax highlighting and autocomplete, although there is still no possibility of setting breakpoints for debugging. I know they are working on an integrated solution, but I guess that will wait for V6…

–Mitch