[Python-Dev] PEP 441 - Improving Python ZIP Application Support (original) (raw)

Barry Warsaw barry at python.org
Tue Feb 17 22:25:28 CET 2015


On Feb 17, 2015, at 08:52 PM, Paul Moore wrote:

I'm pretty sure that's the way the general feeling is going.

Though the more I think about it, the more I like sys.executable. :)

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(poption).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?

(Quoting out of order.)

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.

I was thinking it would be useful to mimic virtualenv's -p/--python option, but I think that doesn't actually do the $PATH parsing, so maybe taking -p verbatim is fine.

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

Well, actually probably utf-8 in most cases, at least for Python 3 on *nix. I'm not sure sys.getfilesystemencoding() is the right encoding, rather than sys.getdefaultencoding(), if you're talking about the encoding of the shebang line rather than the encoding of the resulting pyz filename.

Cheers, -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://mail.python.org/pipermail/python-dev/attachments/20150217/9a280555/attachment.sig>



More information about the Python-Dev mailing list