#! shbang for pyc files?
Jeff Epler
jepler at unpythonic.net
Sat Jun 5 11:13:03 EDT 2004
On Linux, you can use binfmt_misc to recognize pyc/pyo files by magic
number and execute them directly. This was mentioned in some long-ago
release notes. The magic number is different in newer versios of
Python.
- The interpreter accepts now bytecode files on the command line even
if they do not have a .pyc or .pyo extension. On Linux, after executing
echo ':pyc:M::\x87\xc6\x0d\x0a::/usr/local/bin/python:' > /proc/sys/fs/binfmt_misc/register
any byte code file can be used as an executable (i.e. as an argument
to execve(2)).
[http://mail.python.org/pipermail/python-dev/2001-January/012044.html]
Long ago I wrote and submitted a patch to make Python recognize files
with a #! line followed by the magic number, but there seemed to be no
interest.
http://groups.google.com/groups?selm=slrn5jako1.15i.jepler%40craie.inetnebr.com&output=gplain
Having
#!/usr/bin/env python
import myapp
myapp.main()
really won't spend much time byte-compiling, so normally it's not worth
worrying about.
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040605/e39cccbf/attachment.sig>
More information about the Python-list
mailing list