[Python-Dev] Documentation for ability to execute zipfiles & directories
Oleg Broytmann
phd at phd.pp.ru
Tue Mar 4 15:40:51 CET 2008
On Wed, Mar 05, 2008 at 12:14:04AM +1000, Nick Coghlan wrote:
> As a more helpful answer, the ZIP spec allows additional data to be
> included in the file before the ZIP header. A more common way of using
> this is to add a zip file on to the end of an ELF executable while still
> using normal zipfile utilities to read the data in the zip file section
> and ignore the executable part.
>
> It turns out you can actually use the same trick to prepend a shebang
> line like "/usr/bin/env python" and a newline character
That's what I thought, too.
> - the whole zip
> file is still a binary file, but that doesn't prevent the shell from
> reading that first line of text and handing the file over to Python for
> execution.
Unix doesn't distinguish text and binary files. (-:
> The fact that this actually works was also news to me when the issue I
> linked in my previous post was first brought to my attention :)
So it really works? Amazing!
Thank you!
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-Dev
mailing list