GH PYTHON REMOTE - Python to GH error

I have been using GH Python Remote for automation of design & analysis (CFD) task using Python and Grasshopper. Recently, I got a new machine and installed last GH Python Remote version and tried to run my scripts, but got the follwing message in Rhino terminal:

Command: -_RunPythonScript
Python Script ( ResetEngine ): "C:\ProgramData\Anaconda2\Lib\site-packages\ghpythonremote\ghcompservice.py"
Command: 55317
Unknown command: 55317

The command number seems to change everytime I run the script.

This is my python script where I call a user object:

import ghpythonremote
from ghpythonremote.connectors import PythonToGrasshopperRemote

 ...

def export_geometry(x1, x2, x3, x4, x5, x6, x7, x8, x9):
    with PythonToGrasshopperRemote(
        None, r"C:\ProgramData\Anaconda2\Lib\site-packages\ghpythonremote\ghcompservice.py", rhino_ver=7, timeout=500
            ) as py2gh:
        rghuo = py2gh.gh_remote_userobjects
        export = rghuo.userobject(x1, x2, x3, x4, x5, x6, x7, x8, x9)
        output_text = str(export[0])
    output_geo = open(r"control.stl", "w")
    output_geol.write(output_text)
    output_geo.close()

if __name__=="__main__":
    export_geometry(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9)

Which follow methodology as describe here:

What is the problem here?

Just to remark, the script and methodology used to work in my previous machine, but probably was an older GH Pytthon remote version.

I solved the issue. I was not using the appropriate address for ghcompservice.py

Hi @javier.vinuales.nava, sorry I did not have time to look into this last week but I’m glad you found a solution to your issue.

Have you tried our newer products Rhino Compute or Rhino.Inside CPython? They might allow you to simplify your workflows by launching Rhino executables that are really made to be used as a computation server or running inside another app, whereas GH Python Remote is just making CPython talk to a regular Rhino instance and has many quirks because of that.

Hi Pierre,

Thanks for your message. I was not aware of these new products.

Having a first look maybe Rhino Compute could be an option, as all of my framework is in Python and I would rather keep it like that.

Could you access GH User Object through Rhino Compute (in a similar way that I am currently doing)? Could you share an example of this functionality?

You can solve a Grasshopper file in Rhino Compute from Python: https://github.com/mcneel/rhino-developer-samples/blob/7/compute/py/SampleGhBasic/lines.py. If you encapsulate your user object in a gh file I think it would take just minor changes to your script to run that.

Rhino Inside CPython also sounds like it could be a good option for you, here is an exmaple of someone running a GH cluster file from Python: Solving and expiring a cluster correctly with Rhino Inside Python