Hi @eirannejad,
just found by accident that the new script editor does not run IronPython 2 scripts on Mac even when the #! python 2
line is on top. EditPythonScript
and RunPythonScript
both worked.
_
c.
Hi @eirannejad,
just found by accident that the new script editor does not run IronPython 2 scripts on Mac even when the #! python 2
line is on top. EditPythonScript
and RunPythonScript
both worked.
_
c.
Which version?
Hi @eirannejad, it was 8.5.24022.10002 downloaded today.
_
c.
8.5?!?! only 8.3 and 8.4RC are out. Where did 8.5 come from
Internal testing for jeff to check a display related problem. I will wait until the official one is out and then test again
_
c.
Ok sweet. I have done some changes to the language spec parser. Tomorrow’s builds (8.4, 8.5) should not have issues
I"m using Rhino version 8.4 currently, but none of my IronPython scripts that run in Rhino7 have ever run on any version of Rhino8. The error messages are every bit as meaningless and cryptic as the " #! python 2
" line that I stick at the top of the script.
Just to inform you I did translate one of my scripts so that it conforms to python3 and that does run, but it runs 10 times slower than the the python2 version.
The question I have is why would anybody in their right mind use the Rhino8 script editor?
What is the benefits?
The original Python 2 EditPythonScript script editor still exists in V8.
It’s true that the new script editor does not seem to like running Py 2 scripts much - I also get all kinds of errors when I try to run some of mine. I assume that will get fixed one of these days, the new script editor is far from being a finished product. It has turned into much more of a hard-core programmer’s interface as opposed to a more lightweight scripting interface, and the emphasis has been for Python 3 from the get-go.
Mostly I run my existing scripts from aliases or toolbar buttons, or from the old script editor.
Yes I know that, but the topic being discussed is Rhino 8 Script Editor does not run IronPython 2 scripts. And McNeel seems to think Rhino 8 Script Editor does run legacy IronPython scripts, so someone should give them a clue.
You would think that when you put the" #! python 2" line at the top of a script, Rhino would run the code that executes a python 2 script correctly, but no, they got New And Improved code to run the script so they use that even though it doesn’t work.
Still not working in todays (8.4.24023.15001, 2024-01-23)
I mostly get errors like this:
System.NullReferenceException: Object reference not set to an instance of an object.
at Rhino.Runtime.Code.Languages.PythonNet.CPythonCode.Execute(RunContext context)
at Rhino.Runtime.Code.Code.ExecTry(RunContext context, IPlatformDocument& doc, Object& docState)
at Rhino.Runtime.Code.Code.Run(RunContext context)
Sometimes the script will actually run and I get that afterwards. But it doesn’t give me a line number where it errors out.
Sometimes I get this:
Sometimes it will start without an error message, but just not do anything.
@eirannejad
@Helvetosaur
The error is from Python 3 so lets disregard that as it is the wrong python for this script.
I justed tested 8.4.24024.11002 and it is good.
No, let’s not disregard it because I had #! python 2 at the top of the script. I even used File>New IronPython 2 to open a new template and then pasted the script in, doesn’t work.
Not here…
Hi @eirannejad, this reminds me of a feature i’am missing from the EditPythonScript
editor. If an error occurs, the line number is displayed in the terminal and you can double click on it which navigates to the line in the script. Could this be added to the new script editor too please ?
thanks,
c.
I am cleaning up the way editor shows errors so I’ll try to implement this as well
RH-79256 Improve dealing with errors during debug in script editor
Hi @eirannejad, a small improvement suggestion, please run below from the old _EditPythonScript
and the new Editor for comparison, note the prompt behavior:
#! python 2
import rhinoscriptsyntax as rs
def DoSomething():
rs.Prompt("Processing, please wait")
rs.Sleep(1000)
DoSomething()
In the old editor, the prompt vanishes once done, it keeps staying with the new one.
Also if you choose from the R8 menu:
Tools > Script > Edit
then cancel and right click the command prompt to see the last command list, it gets a new entry “Edit…”, it would be nicer if this could be more descriptive, same goes for “Run…”. Btw. choosing this from the menu:
Tools > Script > Run
it allows to choose all kinds of file types…
EDIT: here is another small issue, to repeat it please open the old Editor and the new one and run it from the new editor:
#! python 2
import rhinoscriptsyntax as rs
rc = rs.GetString("Enter something")
On my system it does not set the focus to the main window (the Command Prompt) but the old editor when i start typing. If only the new editor is open, it works as expected. Maybe this is fixable by using SetFocusToMainWindow ?
thanks,
c.
Does this mean there is no hope of ever making the Cpython “incredibaly fast” ?
I notice that for scripts that are compatible with both the new ScriptEditor and the old Rhino Python editor, there is a noticeable difference in speed.
Ok great. Thanks for reporting this. I’ll test today
@jim Let’s keep the performance conversation on that thread. There is hope. But the goal is to make it clear that IronPython and Pythonnet in Rhino 8, are two different ways to put Python language in a dotnet Application (Rhino). They are two architectures and each have their own pros and cons.
We will keep improving the performance to get it as fast as possible.