Re: [Python-Dev] Add a -z interpreter flag to execute a zip file
At 10:34 AM 7/23/2007 -0700, Guido van Rossum wrote:
There's an ambiguity -- a Zip file could start with a Python (or shell, or Perl) script that bootstraps execution. This is used regularly. Changing the semantics just because the file *ends* with something funny sounds like asking for trouble.
Actually, it isn't, because you can't start a zipfile with a Python script. Lord knows I've *tried*, but the Python interpreter just won't accept arbitrary binary data as part of a script. :) Second, unless you somehow managed to overcome that little obstacle, you're not going to be trying to run the zipfile with the Python interpreter, anyway. Instead, the #! line (or .exe header on Windows) will be invoking whatever interpreter or program actually works for that file. Third, if you mistakenly pass an existing such zipfile to a new Python interpreter that supports zipfiles, and there's no __main__.py* file in it, you're just going to get a different error message than the syntax error you'd have received from an older Python.interpreter to run it with -- but otherwise no difference. In other words, AFAICT there's really no ambiguity here.
On 23/07/07, Phillip J. Eby <pje@telecommunity.com> wrote:
Actually, it isn't, because you can't start a zipfile with a Python script. Lord knows I've *tried*, but the Python interpreter just won't accept arbitrary binary data as part of a script. :)
That bit me a while back, hard enough that I thought of putting together a patch for it (probably just to stop processing the script at a NUL byte), but never did as I didn't think I could put a convincing enough case for it being *useful*. Anyway, I'd be happy enough with the -z patch as it stands, or if someone comes up with something better, that would suit me too... Paul.
Just to update everyone on the status of this, the next thing on my list is to figure out the Windows build and set up the the file association in the installer. Actually, I should ask if there's anything else that I should pay attention to here, e.g. do I have to add an icon association for Windows or something like that? Is there any documentation like a wiki page on this? I looked at the README in the PC* directories and it doesn't seem to talk about the installer. Maybe it will become clearer when I get Visual Studio. Andy On 7/23/07, Paul Moore <p.f.moore@gmail.com> wrote:
On 23/07/07, Phillip J. Eby <pje@telecommunity.com> wrote:
Actually, it isn't, because you can't start a zipfile with a Python script. Lord knows I've *tried*, but the Python interpreter just won't accept arbitrary binary data as part of a script. :)
That bit me a while back, hard enough that I thought of putting together a patch for it (probably just to stop processing the script at a NUL byte), but never did as I didn't think I could put a convincing enough case for it being *useful*.
Anyway, I'd be happy enough with the -z patch as it stands, or if someone comes up with something better, that would suit me too...
Paul. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/andychup%40gmail.com
New icons get added so rarely that each time it happens, Windows has changed enough to make the instructions invalid... I do remember creating icon associations for .py, .pyc, .pyo and .pyw, and separate "open" associations for these. IIRC the two associations are quite independent. Probably everything has changed though since we now use MSI. --Guido On 7/23/07, Andy C <andychup@gmail.com> wrote:
Just to update everyone on the status of this, the next thing on my list is to figure out the Windows build and set up the the file association in the installer. Actually, I should ask if there's anything else that I should pay attention to here, e.g. do I have to add an icon association for Windows or something like that?
Is there any documentation like a wiki page on this? I looked at the README in the PC* directories and it doesn't seem to talk about the installer. Maybe it will become clearer when I get Visual Studio.
Andy
On 7/23/07, Paul Moore <p.f.moore@gmail.com> wrote:
On 23/07/07, Phillip J. Eby <pje@telecommunity.com> wrote:
Actually, it isn't, because you can't start a zipfile with a Python script. Lord knows I've *tried*, but the Python interpreter just won't accept arbitrary binary data as part of a script. :)
That bit me a while back, hard enough that I thought of putting together a patch for it (probably just to stop processing the script at a NUL byte), but never did as I didn't think I could put a convincing enough case for it being *useful*.
Anyway, I'd be happy enough with the -z patch as it stands, or if someone comes up with something better, that would suit me too...
Paul. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/andychup%40gmail.com
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
Andy C schrieb:
Just to update everyone on the status of this, the next thing on my list is to figure out the Windows build and set up the the file association in the installer. Actually, I should ask if there's anything else that I should pay attention to here, e.g. do I have to add an icon association for Windows or something like that?
Is there any documentation like a wiki page on this? I looked at the README in the PC* directories and it doesn't seem to talk about the installer. Maybe it will become clearer when I get Visual Studio.
It's all in Tools/msi/msi.py. Just look for the other extensions; the change should be fairly straight-forward. Regards, Martin
participants (5)
-
"Martin v. Löwis" -
Andy C -
Guido van Rossum -
Paul Moore -
Phillip J. Eby