On 23Mar2020 17:59, Frédéric De Jaeger <fdejaeger@novaquark.com> wrote:
There is a recurring problem in my company where we use python in various places (python3). We do cross platform development windows/linux and our python scripts need to run everywhere. Some scripts are launched manually in a terminal. Others are launched via windows' gui interface. Others are launched through our build process (cmake based, but also manual Makefile) And others are launched via bash scripts. And possible several other scenario I've forgot.
On windows, most users use Cygwin to do their terminal based business (`git`, `cmake`, ...).
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.
The command
python3 myscript.py
does not run on windows with the latest python distribution I've played with (sorry if it has been fixed recently, this whole mail becomes pointless). [...] 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)
I'm sure, I'm far from being the first user complaining about that. Sorry if the request has been been made numerous time before.
I'm sticking my oar in here because this whole thread seems to sidestep Frédéric's question: WHY isn't there a python3.exe installed with a version 3 Windows python install? With that, the "#!/usr/bin/env python3" and command line "python3" invocations would Just Work. There might be fiddling around locating the specific python3 (see Eryk's long posts about how the launcher and various environments do their searching), but at least the user would always get a version 3 Python, and if there's just one Python 3 on the box, they always get the _correct_ Python 3. The point isn't "what Python does 'python' get you?", it is "why can't we make 'python3' find a Python 3 universally, including from a shebang?" It seems to me that there is a deliberate choice to _not_ install the "python3" executable name when installing Python 3 on Windows, and to my eye that is/was a _bad_ choice. I would like to see a good explaination as to why that choice was made. Choosing Python 3 specificly is an important choice for many scripts because 2->3 was a breaking change. Cheers, Cameron Simpson <cs@cskk.id.au>