Continuing working on this problem, I noticed that python.exe appears in Task Manager - Details when any of the following is done (after starting a new and only instance of Rhino 8):
_ScriptEditor
_-ScriptEditor _Run then choosing any file to run as a script, including non-Python 3 scripts.
_RunPythonScript then choosing any file to run as a script, including non-Python 3 scripts.
However, _EditPythonScript then picking either Start Debugging or Start Without Debugging
does not start python.exe.
Instead, can python.exe only be started when the first Python 3 script is actually encountered – selected to be executed or loaded into the Script Editor?
python.exe starts when any of the 3 items stated above occur, regardless if Python 3 or subprocess are involved.
After posting the message above, I got the referenced subprocess problem working by setting or deleting PYTHONHOME in my scripts.
Ignoring the (hopefully solved) subprocess problem, if one is only running IronPython or C# scripts, I imagine the initial execution of those scripts would start sooner if python.exe and its related are not started.
Okay I’m just gonna add a few current implementations here so we are on the same page:
python.exe subprocess is the language server for Python 3 that provides autocompletion, linting, etc to the editor.
Currently when ScriptEditor is launched all the supported languages are initialized so creating a new script does not take a long time and support functionality is available to the editor.
_RunPythonScript is legacy script runner. It only integrates with the new scripting tools if the target file contains #! python3 or has .py3 extension.
_EditPythonScript has nothing to do with python.exe or the new scripting tools. That is the legacy editor only running IronPython
Grasshopper generic “Script” component initializes all the languages since it can run any language. Similar to ScriptEditor
Language-specific Grasshopper script components only initialize their own language.
Improvements:
I will make sure _-ScriptEditor _Run does not initialize languages other than the scripting being executed. ( RH-83861 ScriptEditor Run should only init script language)
I would like to know specific problems you have running your own python.exe inside of Rhino. I would appreciate if you can share any error messages or an example that replicates the problem you are having.
It was only the subprocess problem. I didn’t get it working in June and now don’t know whether it was something I was doing and/or updates to Rhino.
Yesterday, I noticed that even starting the process from a C# script via _-RhinoScript _Run from a fresh instance of Rhino caused python.exe to start and lead to the error. I didn’t find information concerning why and decided to create this thread.