Hi Fred,

If windows users associate .py with the py.exe launcher, (and .pyw with the 
pyw.exe launcher), then it will default to python 3 (highest version installed, 
64 bit if available), and will honour a `#! python3` shebang, (with a number of 
formats accepted). It should also be reasonably easy to teach the users to 
type: py scriptname rather than python or python3 scriptname (less to type 
rather than more).

The link for details is 
https://docs.python.org/3/using/windows.html#python-launcher-for-windows and 
there are details on installation further up the page.

Hope that this answers your problem.

Steve Barnes


-----Original Message-----
From: Frédéric De Jaeger <fdejae...@novaquark.com> 
Sent: 23 March 2020 18:00
To: python-ideas@python.org
Subject: [Python-ideas] About python3 on windows

Hi all,

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).

Human can learn which command to run, it's ok.  But for all other invocations 
context, this becomes very annoying.  Surprisingly, `cmake` is the more 
friendly, since `FindPython` will returns a python3 first.

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 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. 

What it the status on this point ?  

Thanks a lot.

Fred
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an 
email to python-ideas-le...@python.org 
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/PTYLAO7YXM4UH3CEI3BRBRALM3AL4HJQ/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YAGPL3NO7J4MQYGGFT6R2JWFYESWIFJJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to