Hola,
I am experiencing a persistent issue with the native GHPython (IronPython 2) component in Rhino 8.17. The sticky dictionary, which should be a predefined global variable, is not being recognized, resulting in a NameError.
Component Used:
I am explicitly using the “IronPython 2 Script” component found under the Script tab in Grasshopper (not the CPython 3 component).
Minimal Test Case:
Even the simplest script to test sticky fails:
# Minimal Sticky Test for IronPython 2
print("Attempting to access sticky...")
if "counter" not in sticky:
sticky["counter"] = 0
else:
sticky["counter"] += 1
a = sticky["counter"]
print("Counter value (if successful):", a)
content_copydownload
Use code with caution.Python
Error Received:
When running the minimal script above, I consistently get the following error and traceback:
Runtime error (UnboundNameException): name 'sticky' is not defined
Traceback:
File "<string>", line 3, in <module> # O la línea donde se usa 'sticky' por primera vez
NameError: name 'sticky' is not defined
IronPython.Runtime.UnboundNameException: name 'sticky' is not defined
[... Pega aquí el traceback completo que obtuviste la última vez ...]
content_copydownload
Use code with caution.
Safe Mode Test:
Crucially, I have tested this in Rhino 8 Safe Mode (/safemode):
-
Started Rhino 8 using the /safemode flag.
-
Clicked “Yes” to load GrasshopperPlugin.rhp when prompted.
-
Clicked “Yes” to load RhinoDLR_Python.rhp (the IronPython 2 engine) when prompted.
-
Opened Grasshopper, added the “IronPython 2 Script” component.
-
Pasted the minimal test script above.
-
The NameError: name ‘sticky’ is not defined error STILL occurs even in Safe Mode.
Troubleshooting Already Attempted:
-
Confirmed using the correct “IronPython 2 Script” component.
-
Tested on a clean installation of Rhino 8
-
Previously experienced the same issue on Rhino 7.
-
Ensured no old/conflicting Python component GHAs were installed.
-
Attempted repairing the Rhino 8 installation.
-
Tested in Safe Mode (as detailed above).
Question:
Given that the sticky dictionary should be provided by the IronPython 2 environment within Grasshopper, and the error persists even in Safe Mode, could you please help diagnose why it might not be defined on my system? What could cause the GHPython environment initialization to fail in this specific way?
Any insights or further diagnostic steps would be greatly appreciated.
Thank you!