Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4159

Rhino Python Editor: No module named Grasshopper

$
0
0

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:

image

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?

6 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4159

Latest Images

Trending Articles



Latest Images