Reference: Running Python scripts via IronPython 2 vs. CPython 3

Script File Name Extension Shebang Implementation Used by _RunPythonScript Implementation Used in Rhino Python Editor
(_EditPythonScript)
Implementation Used by _-ScriptEditor _Run or
in Script Editor (_ScriptEditor)
.py None 2 2 3
.py #! python 2 2 2 2
.py #! python 3 3 2 3
.py2 None Error because extension is not allowed Error because extension is not allowed 2
.py2 #! python 3 (mismatches extension) " " 3
.py3 None " " 3
.py3 #! python 2 (mismatches extension) " " 3

The language specifier shebang, #! python 2 or #! python 3, is placed near the top of the script.

Results are from 8.28.26041.11001, 2026-02-10

1 Like