If i start Rhino and press a custom Button which executes a custom Python script I get an error message:
“Message: expected an indent Block …” which is totaly misleading as the error does not have anything to do with indentation. Instead I have to open the Python Editor and click on the left side, first on then on" rhinoscriptsyntax" then on" application" and sometimes also on “Rhino” to load the modules, depending on which module is imported in my script. After that everything works fine. How can I get Rhino to load all the native modules by default?
sorry if this has been discussed before
@ralph_schoeneberg, hard to say what’s wrong without any code to test. Which modules do you import ? By default, Rhino does not import modules automatically and some searchpaths are required so the modules can be imported. Do you see a similar problem when running your script from the python editor ?
Please post the code and probably a screenshot of this dialog:
_EditPythonScript > Tools > Options > Files
Probably by creating a script which is called using a startup command. You can set them up from:
_Options > Rhino Options > General > Command Lists
But i would first try to investigate why loading things from a button fails.
The standard library should be referenced by default, you can try to run
help("modules") to output a complete list of available modules on your system:
If you’re not seeing the standard library here, that could be a sign of a botched installation. You can try to restore the defaults paths:
And perhaps inspect the folders where the Rhino IronPython distribution is located to verify that all the modules indeed are there (i.e.
C:\Program Files\Rhinoceros 5.0\Plug-ins\IronPython\Lib)
Thank you for your answer. I forgot to mention, I am using Rhino 6.
this is a screenshot from my script, nothin fancy, and the search path window.
the error goes away after clicking on “rhinoscriptsyntax->application”, I also clicked on “Restore RhinoScriptSyntaxFiles”
It’s not depending on the script, it is with every script, and the button thing is also not important as it happens in the python editor too.
the command help(“modules”) yields:
no documentation found for ‘modules’
I tried on my second Computer, and there the script works, so it must be a configuration on my side. Although the command help(“modules”) also gives a “no documentation found for ‘modules’”
here i the script as text, if you want to try it out
import rhinoscriptsyntax as rs
if( name == ‘main’ ):
sel = rs.SelectedObjects()
BlockInstanceName = rs.BlockInstanceName(sel)
BlockInstanceName = BlockInstanceName.replace(" “,”")
filepath = “E:\work\test\fbx\”
filename = filepath + BlockInstanceName
rs.Command("-Export " + filename + “.fbx _Enter”)
print “nothing selected”