Executable standalone *.pyc after inserting "#!/usr/bin/python" or other options

epsilon cesmiga at gmail.com
Thu Jan 14 16:55:28 EST 2010


All:

I've been playing with "Lua" and found something really cool that I'm
unable to do in "Python". With "Lua", a script can be compiled to byte
code using "luac" and by adding "#!/usr/bin/lua" at the top of the
binary, the byte code becomes a single file executable. After I found
this trick, I ran back to "Python" to give it a try.  Well...  it
didn't work. Is this possible?  There are tools which insert "python"
and related modules inside the byte code, but this is not the
requirement for this situation. The required solution is to insert "#!/
usr/bin/python" (or some string) at the top of a *.pyc byte code file
and run it as standalone executable.  I'm excited about the
possibility and interested in hearing your thoughts.

Thank you,
Christopher Smiga



More information about the Python-list mailing list