Replying to my own question here after some testing…
So, one of the changes to Python 3 is that the print statement in P2 is now a function in P3 - requiring the line to be printed to be enclosed in parentheses
Py2:
print "Hello Rhino"
Py3:
print("Hello Rhino")
OK, fine, but as I am in a country where the various languages use à çcénted characters, in Py2 where I had localized prompts and user feedback, I had to put
#!/usr/bin/env python
# -*- coding: utf-8 -*
at the top to keep it from erroring out. Apparently Py3 does not need that, and in testing that with the new ScriptEditor, I have run into a few funny things. The ScriptEditor can run either Py2 or Py3 scripts by putting #! python 2
or #! python 3
at the top. So I tried first this:
#! python 2
print "à ï çéé üû"
The first time I run it, I get the correct thing printed at the command line - and this despite that I did not put the utf-8 thing at the top:

What’s interesting is that I see the following in the Terminal window:

Where’s that second line (missing the first character) coming from?
Then if I run the script again immediately after I get this:

Huh? The script output is concatenated to the weird second line… Every succeeding run prints the same thing.

Weird. If I reset the script engine, it runs once correctly and then the same error. Adding the utf-8 argument at the beginning doesn’t help.
OK, so let’s try Py3:
#! python 3
print "à ï çéé üû"
I know this is the wrong syntax for Py3, but I want to see what it does…
I get an error “Runtime is not configured”
System.Exception: Runtime is not configured
at Rhino.Runtime.Code.Languages.PythonNet.CPythonCode.ExecutePython(ExecuteContext context)
at Rhino.Runtime.Code.Code.Run(ExecuteContext context)
OK I thougt I would just get a compilation error but whatever… Let’s fix the code:
#! python 3
print("à ï çéé üû")
Oops - same error… Something else is wrong. Resetting the Python 3 engine doesn’t help.
OK, will close Rhino 8 and reopen to see if that helps. That re-deploys everything, have to wait a couple of secs. Run the above again. Correct result the first time, and each succeeding run, so that’s good. No utf-8 initiation needed.
Let me un-fix the code to see if I can make it error out again
#! python 3
print "à ï çéé üû"
This time I get a “Compile Error” as I should. OK, almost done here, going back to Py2 to repeat the error:
#! python 2
print "à ï çéé üû"
Now I get a compile error. It should run, but it doesn’t.
Running with parentheses (like Py3 format) works:
#! python 2
print("à ï çéé üû")
And multiple times correctly…
So - there seems to be some crosstalk between running Py2 and Py3 scripts and the new editor is getting confused. It seems to be more than a simple affair of putting #! python 2
or #! python 3
at the top…
@eirannejad …