the PEP is pretty perfect.
#!/usr/bin/env python_binary_this_script_runs_with
if it runs with python 2: #!/usr/bin/env python2
if it runs with python 3: #!/usr/bin/env python3
if it runs with both: #!/usr/bin/env python
the only thing worth discussing IMHO is if python 3 should start shipping with all symlinks from past 3.x minor versions to the newest minor version. then we could switch to #!/usr/bin/env python3.4
if it uses e.g. pathlib
and would be sure that the script will work with future versions. but then again, users can install pathlib for 3.3…
On Wed, Mar 11, 2015 at 5:54 PM, Chris Barker <chris.barker@noaa.gov> wrote:On Wed, Mar 11, 2015 at 3:41 PM, Gregory P. Smith <greg@krypto.org> wrote:I think /usr/bin/env is a bad idea to promote. It changes from an explicit designation of what you need in order to execute to something being derived from the users $PATH. It is *less specific* than /usr/bin/python. For some people that is the goal, but I discourage it.I don't think the goal is specificity, or lack there of, but a shift in control:Who controls where python is installed?If you put an explicit full path on the #! line, then the script author controls which python is used, AND where it must be installed.If you put /usr/bin env on the #! line, then the script author is saying 'use python", and the script user can have python installed anywhere they want, and can use PATH to tell everything what the default it.I think that _should_ be encouraged -- but ideally with some versioning:#!/usr/bin/env python2or even:#!/usr/bin/env python3.4Please, just explicit major versions, not minor ones. python3, not python3.4. Just earlier this year I had to fix about 20 scripts that ran perfectly on 3.4 but whose hashbang explicitly used 3.1. It sucks.--If any of you remember what a pain it was when RedHat installed system tools with (I think):!#/usr/bin/env pythonYou'll know what a nightmare that was -- you could not upgrade the 'default" python without breaking stuff.So system tools should probably use the full specific path -- the script is tied closely to the environment. But if they had at least put a version in there, it would have worked fine:#!/usr/bin/env python1.5These days, I try to use distutils or setuptools to install scripts, and they can do the right thing to use the correct python to start up anyway...-CHB
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/_______________________________________________--Ryan[ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong.
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/