On 17 February 2015 at 18:52, Barry Warsaw <ba...@python.org> wrote: >>So, the options I see: >> >>1. Stick with /usr/bin/env python >>2. No shebang unless -p is specified >>3. Unix users come up with a solution which is the same as the above >>for Windows users, but which suits them better. > > #2 seems to me to be the most reasonable alternative. The resulting pyz files > (built w/o -p) would still be explicitly executable, just like .py files.
I'm pretty sure that's the way the general feeling is going. > However, -p must be able to accept any number of strings, including > "/usr/bin/env python3" if the user wants that. The code simply writes '#!{}\n'.format(p_option).encode(sys.filesystemencoding()) to the file, so you can put whatever you want in. Given that it isn't the name of the Python executable, maybe the option should be --interpreter instead? Oh, and am I right that the shebang line should be encoded using the filesystem encoding on Unix? I know 99.999% of use cases will be ascii, but someone could have a Python interpreter in /home/léon/.local/bin/python... > Probably the best thing to do (on *nix at least) is, if the path is absolute, > use the given string verbatim. If the path is relative, search for the given > executable on $PATH and use the first one found. If nothing is found, use > what's given explicitly. I'm not quite sure what you mean here, but maybe you're thinking that the -p option is the executable name rather than what gets put in the #! line directly? Let me know if it's not covered by what I've already said. Paul _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com