Hi,

I wanted to make a python byte-code file executable, expecting to be able to 
run it without specifying "python" on the (Linux bash) command line.

So, I wrote the following:

[r...@vmlinux1 python]# cat test_pyc.py
#!/usr/bin/env python

print "hello"
[r...@vmlinux1 python]#

and made its pyc file executable:

[r...@vmlinux1 python]# ls -ls test_pyc.pyc
4 -rwxr-xr-x  1 root root 106 Jul 29 14:22 test_pyc.pyc
[r...@vmlinux1 python]#

So, I see:

[r...@vmlinux1 python]# file test_pyc.py*
test_pyc.py:  a python script text executable
test_pyc.pyc: python 2.3 byte-compiled
[r...@vmlinux1 python]#

If I try to do the following, no problem:

[r...@vmlinux1 python]# python test_pyc.pyc
hello
[r...@vmlinux1 python]#

However, the following fails:

[r...@vmlinux1 python]# ./test_pyc.pyc
-bash: ./test_pyc.pyc: cannot execute binary file
[r...@vmlinux1 python]#

Is there a way to run a pyc file without specifying the python path ?

Bye,
Ron.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to