A bug was discovered in SR12 (also affects Rhino for Mac 5.0.2 and earlier) yesterday that explains why some of you have started getting a “Message: ‘module’ object has no attribute ‘_’” error.
A script that looks like this:
import rhinoscript.userinterface import rhinoscriptsyntax as rs rs.GetLayer()
generates the error:
"Message: 'module' object has no attribute 'GetLayer'"
What appears to be happening is that the 1st import loads the userinterface module so when the 2nd import statement runs the module is not reloaded and therefore the rs alias is not associated with functions in the userinterface module. The script works after deleting the 1st import and reseting the script engine so it looks like the explanation is correct.
But the above script works in SR11 which mean that the explanation is in fact incorrect. After some digging a bug was discovered in SR12 that causes this problem. The bug only manifests itself in scripts that have the line “import rhinoscript.userinterface” followed by the line “import rhinoscriptsyntax as rs” (‘rs’ or any other alias).
Even though the bug is in SR12 and not the script the solution is still to modify the script since in this context the 1st import doesn’t make sense. So to fix:
- delete the
- restart the script engine or restart Rhino
I hope this helps and sorry for the confusion.