Hi all,
My Rhino Python Editor can no longer import the Grasshopper module.
I wrote a little script (script A) that opens grasshopper files from Python.
import rhinoscriptsyntax as rs
import Grasshopper as gh
import os
docName = rs.DocumentName()
docPath = rs.DocumentPath()
ghPath = docPath + docName[:docName.rfind(".")] + ".gh"
if os.path.exists(ghPath):
print "Opening associated GH file ", ghPath
gh_scriptinterface = gh.Plugin.GH_RhinoScriptInterface()
gh_scriptinterface.OpenDocument(ghPath)
It was working just fine until, I tried to run script A from a subprocess while opening a 3DM file, something like the below (script B)
callScript = '"{0}" "{2}" /nosplash /runscript="{1}"'.format(rhinoPath, scriptCall, fileName)
subprocess.call(callScript)
Now my Rhino python editor cannot import Grasshopper at all. I get the following error message:
I restarted my computer and the issue persists. âimport Grasshopperâ was working perfectly fine until I tried to launch script A from another subprocess, now it is unrecognized.
How do I fix this?