Thank you so much. This has been very helpful.

On Fri, Dec 19, 2008 at 12:21 PM, Andreas Kostyrka <andr...@kostyrka.org>wrote:

> Am Fri, 19 Dec 2008 09:01:24 -0500
> schrieb "Emad Nawfal (عماد نوفل)" <emadnaw...@gmail.com>:
>
> You are not supposed to compile the main script.
>
> pyc files are automatically generated when you import the py file (but
> not execute it), if you are allowed to write them beside the py file.
>
> When a pyc file exists, and it's newer than the py file, python will
> import the py file from the pyc file, thus saving on parsing the py
> file.
>
> In effect the pyc file is nothing more than a file cache for the parsed
> and bytecompiled version of the py file.
>
> Andreas
>
> > 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 :
> >
> >
> > e...@emad-laptop:~/Desktop/Programming/Haskell$ chmod  +x  hello.py
> > e...@emad-laptop:~/Desktop/Programming/Haskell$ ./hello.py
> > Hello Tutors
> >
> > Now I compile it in Python:
> > >>> import py_compile
> > >>> py_compile.compile("hello.py")
> > >>>
> > e...@emad-laptop:~/Desktop/Programming/Haskell$ chmod +x hello.pyc
> >
> > e...@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    dGHd S( s
> >                                          Hello
> > TutorsN((((hello.py<module> s'
> > e...@emad-laptop:~/Desktop/Programming/Haskell$
> >
> >
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>



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

Emad Soliman Nawfal
Indiana University, Bloomington
http://emnawfal.googlepages.com
--------------------------------------------------------
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to