Importing ghpythonlib using Rhino 8 Script Editor

This may not be intended to work regardless, but while investigating some capabilities of the new script editor, I have run into a bug which crashes Rhino. I have a Grasshopper script which I am currently running with GrasshopperPlayer so that the user is prompted via the command line. I am looking to convert this to a python script, though, for more control and to hopefully run without accessing a GH file altogether. The script I have, however, uses components from various GH plugins, some of which would be very difficult to replace purely with python (e.i. Urbano).

All this to say, I attempted to import the ghpythonlib library within Rhino’s script editor. This caused no issues when Grasshopper had been already launched for that instance of Rhino, but when imported before launching Grasshopper, Rhino crashes. Is there a recommended way around this, or am I forced to run a GH file because of the plugins? Thanks in advance for any help.

@Nicholas_Van_Son

  • Does rhino leave a crash text on your desktop? Did rhino prompt to send a crash report to us?
  • I can run import ghpythonlib in a empty script, in the main ScriptEditor, before Grasshopper is loaded without any problems. This import causes Grasshopper to load in the background however. Would you be able to share a small script that replicates the crash?
  • Which Grasshopper plugins do you have installed? It helps for me to know so I can install here as well and can replicate the crash

Update:
I installed Urbano 1.4.2 and can not replicate the crash

Hi Ehsan,

Rhino does not leave a crash report to send, and unfortunately I did not think to check for a crash text file. I should have clarified that the crash does not occur until I actually start using the library. I can add the import ghpythonlib (as gh) just fine, but as soon as I reference it (i.e. gh.Components. etc.) the command line begins to load grasshopper like you said, but then freezes and crashes.

I am away from my computer at the moment and can get a full list of plugins later, but here is a list of the top of my head. It would be interesting to see via the command line if Rhino crashes after a particular plugin is loaded each time.

Pufferfish
Weaverbird
Lunchbox
Urbano
Human
Elefront

I will try to get back to my computer for more details soon, but wanted to provide what details I could now.

1 Like

@eirannejad

Apologies for the delayed update. I have finally had the opportunity to test the GH library in ScriptEditor again. Importing the library doesn’t cause issues until I trigger it to actually load. In other words, “import ghpythonlib as gh” is fine, but “gh.” begins to load the libraries. Rhino’s command line then displays the plugins as they load and crashes after getting to GHPython. It leaves no crash text on my desktop or in the folder directory. Here is a window screenshot from when it is frozen just before it crashes.


Again, the issue doesn’t come up if Grasshopper is launched beforehand. The plugins I have installed are:

Kangaroo2
Honeybee
Dragonfly
Ladybug
Pufferfish
eleFront
Urbano
Metahopper
Fologram
Lunchbox

Thanks for your help!

@Nicholas_Van_Son

Hi. I made a few modifications for the next 8.4 RC build to autocomplete modules on the main thread. It has fixed a few similar crashes. I would appreciate if you can test and let me know if it works for you as well. another 8.4RC build is coming out on Tuesday.