Rhino 6: "No module named GhPython.Assemblies" after hit "Reset Script Engine" button

Hello,

The title here almost says it all. Using the Rhino 6 Evaluation version and developing some python scripts, I happen to get this error message each time I hit the “Reset Script Engine” button. At that moment, the only work around I found is to close Rhino completely and restart it. Running in administrator mode changes nothing.

Is it something someone has ever seen? Is there a solution for that?

Thank you!

Hi Alexandre

if you are new to scripting in Rhino, the “Reset Script Engine” menu item is not really meant for you. It’s meant for some last-resort operations that happen in precarious circumstances, and even then, won’t work all that well (as you noticed).

If you are trying to reload a module, the real Python way is the reload() function. There’s nothing more appropriate and effective than that. In current IronPython:

import mymod
reload(mymod)

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

1 Like

Hi Giulio,

Thanks for your answer. About the reload function, is it meant to be used directly in command line, after having modified a python script file?

Otherwise, is it supposed to be used in the python files? If I understand well, this would imply to call reload() after each import? This would be a little cumbersome since there are over 100 python files in our project, and over 1000 import commands.

If I want to avoid that, what is the best way to make sure all the changes are loaded, other than restarting Rhino completely? I had no problem using the “Reset Script Engine” button in Rhino 5

Thanks again for your help,

Alexandre

It’s a Python function, it must go in Python source.

It’s supposed to be used in the scope that performs the import, to reload the file/module that you are working on. I don’t know what other scenarios you are working with, but working on 100 files contemporarily, will certainly require some other debugging ways.

Reset never worked fully well in GhPython, because GhPython loads a scope from the engine to re-run code quickly. If you delete the old engine, the scope will not work anymore.