Documentation strings not used in GH_Component SDK mode

I’m having trouble with ghenv when compiling.
The triple quote string doesn’t change my input names or description (why?) so I wanted to use ghenv. Script would run fine but when compiling, it throws this error to me.
@piac

Hi @Will_Wang

ghenv was added for compiled components after Rhino 6 SR0 (I believe it was SR2). You are not allowed to do anything outside the component-derived class (in your example, MyComponent). In fact, only that class is instantiated for each new component.

However, the reason your strings are not getting caught is that they need to be the first thing in the module, before all the imports.

Finally, as a good understanding exercise, you may just want to copy the code and compile it yourself. Then you can change all properties of the input and output params and understand what is going on under the hood.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

1 Like

Thanks so much! I’ll stick with the triple quote then.
Just for my own information, what do you mean by compile it myself? Sorry not a programmer.

Well, you are being now :slight_smile:

You can compile by using the code following the step “2. Advanced compiling” of the tutorial.

A post was split to a new topic: How to add Grasshopper library icon in GhPython compiled GHPYs