Are there any issues editing and running older iron Python scripts in the new Rhino 8 Editor. Can these scripts be converted to Python 3 easily? I’ve tried to edit some older scripts that won’t run in Rhino 8 and had some quirky results. For example I’ll comment out some lines and when I run the script in the editor and step through it I can see it reading and executing some of the commented out text. Very strange and I can’t get the scripts to run properly. If I copy and paste the script into a new window it runs fine. Thanks for the help.
Haven’t experienced any problems opening IronPython scripts in the new editor. You will probably need to change some syntax in older scripts depending on how you wrote them, notably print statements and some ways to import modules, etc. Other reasons they might not run is that some RhinoCommon methods have changed for V8.
Curious why this is not allowed any longer: SyntaxWarning: import * only allowed at module level
Here is my script using import *.
def getRunnngXL():
try:
import System
import os
import clr
user = os.environ["USERPROFILE"]
#C:\Users\ebunn\SEE RhinoScript
path = user + "/SEE RhinoScript/XL_Utils/bin/Release/net48/Utils.dll"
print (path)
clr.AddReferenceToFileAndPath(path)
from Utils import *
excel = Marshal2.GetActiveObject("Excel.Application")
print(excel,"Excel")
return excel
except:
print("Excel not Running")
Problem is if I locate the line “from Utils import *” outside of the function is doesn’t work. It relies on the other commands before it within the function. Looking for a work around.
Maybe I should be posting this problem there? It’s really a problem with the new ScriptEditor. The script works fine when run from the old IronPython editor.