[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: import overwrites __name__
From:       Marco <marco.mandl () gmx ! at>
Date:       2009-05-08 21:37:25
Message-ID: gu28ml$6j7$1 () ger ! gmane ! org
[Download RAW message or body]

Stephen Hansen wrote:

>>
>>  So what leads to the behavior that the .pyc is not created?
>>
> 
> PYC's are only generated on import, they're never made for the main
> script.
> 
> I personally like to keep my 'main script' very small. Largely just
> something which imports other modules and sends them along on their
> business.

Thanks Stephen,

I just learned that. But still I don't know why there is a different 
(correct) behavior when the main module is compiled.

As a work-around I put this on top of my main script:

import py_compile
py_compile.compile(__file__)

Still I appreciate if someone could explain me why.

br
Marco 


--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic