#! shbang for pyc files?

MarkV markv_at_letitrain_com at yougettheidea.com
Sat Jun 5 16:56:53 CEST 2004

Is there a way to make it possible to execute a compiled python file
(whatever.pyc) on a linux/unix system without requiring the user to type
"python whatever.pyc"? In the case of a .py file, you can put "#!
/usr/bin/python" at the top and chmod +x, and then you don't even need the
.py extension to run it - just type "whatever" - but when you compile the
file, it loses this ability!

FYI, the context here is that we want to distribute scripts as part of an
application, but we don't want users to go mucking around with the scripts.
Yeah, I know, that's half the fun, but they don't get to muck around with
the C programs, and when they do muck around with the current shell scripts,
it causes us fits because their changes don't get into our source control.

Thanks in advance for any suggestions.

More information about the Python-list mailing list