[Tutor] py_compile and chmod +x

Emad Nawfal (عماد نوفل) emadnawfal at gmail.com
Fri Dec 19 15:01:24 CET 2008


Hi Tutors,
#! /usr/bin/env python
print "Hello Tutors"

I have this script saved as hello.py. Why can  I execute it, but not the
compiled version?  or am I doing something wrong? Just curious. Any help
appreciated.
For example :


emad at emad-laptop:~/Desktop/Programming/Haskell$ chmod  +x  hello.py
emad at emad-laptop:~/Desktop/Programming/Haskell$ ./hello.py
Hello Tutors

Now I compile it in Python:
>>> import py_compile
>>> py_compile.compile("hello.py")
>>>
emad at emad-laptop:~/Desktop/Programming/Haskell$ chmod +x hello.pyc

emad at emad-laptop:~/Desktop/Programming/Haskell$ ./hello.pyc
: command not found: �
./hello.pyc: line 2: syntax error near unexpected token `('
./hello.pyc: line 2: `�KIc@s    dGHdS(s
                                         Hello
TutorsN((((hello.py<module>s'
emad at emad-laptop:~/Desktop/Programming/Haskell$


-- 
لا أعرف مظلوما تواطأ الناس علي هضمه ولا زهدوا في إنصافه كالحقيقة.....محمد
الغزالي
"No victim has ever been more repressed and alienated than the truth"

Emad Soliman Nawfal
Indiana University, Bloomington
--------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081219/00ce0c3b/attachment.htm>


More information about the Tutor mailing list