On Mon, Mar 23, 2020 at 05:59:41PM -0000, Frédéric De Jaeger wrote:
The issue is: There is no reliable way to launch a python script.
The command:
python myscript.py
launches python3 on windows and python2 on 99% of the unix market.
Its probably less than 99% by now, but still quite high. Do I understand you that "python" (without a full pathname) is supported on Windows? If I understand Brett's later comment, I expect that by default your Windows users will need to type the full pathname, since Python isn't added to the PATH. Are you familar with the py.exe Windows launcher? Does it help? https://www.python.org/dev/peps/pep-0397/ Perhaps you can just have your Windows users call "py myscript.py" and your non-Windows users call "myscript.py" (after setting the appropriate hashbang referring to python3).
At the moment, we have scripts that run under version 2 when run by a linux user and version 3 on windows. This works by pure luck.
If I have understood your problem correctly, I think the smallest, least invasive change to have this all "just work" is: - have all your scripts specify "python3" in their hashbang rather than "python"; - add a "python3 --> python" alias on Windows. Which I think is what you are asking here:
If the standard python distro would just provide a simple `python3` binary/alias, then all the stars would align perfectly. the basic shebang
#! /usr/bin/env python3
would work everywhere by default, without requiring any tweaking (install a python3 alias on windows, or ask linux users to change the default `python` symlink)
In other words, your idea is for Python on Windows to support "python3" as well as "python". Is that correct? I'm not a Windows user, so I don't know if there is a downside to that idea, but if your analysis is correct is seems like a good, simple idea. -- Steven