[Tutor] Re: display filter slow

dman dsh8290@rit.edu
Tue, 18 Dec 2001 10:51:15 -0500

On Tue, Dec 18, 2001 at 11:10:41AM +0530, Prahlad Vaidyanathan wrote:
| The reason it was taking so long to start was that the python
| interpreter itself was taking a very long time to load. On startup, the
| interpreter tries to import a whole bunch of site-packages. All the
| packages it tried to import had a 'bad mtime' - hence it tried to
| byte-compile the .py file into the .pyc equivalent. Since I didn't have
| write-access to the /usr/lib/python2.0 directory, it complained, but
| continued nonetheless. But, the delay involved in recongising and
| reporting this problem caused the overall delay of the script.
| Now, what I want to know is this :
| * Why did python try importing a whole bunch of site-packages when I did
| not give explicit instructions to import them

It imports "site.py" unless you explicitly say not to.  That script
often imports a bunch of standard stuff.  The site.py script is a way
that an admin can customize the local installation (set sys.path or
something, for example).

| * Why were the mtimes for the .pyc files bad (This is prolly a problem
| with my personal python package, but maybe it's universal)

The mtime (last modified) of the .py file is more recent than the .pyc
file.  Therefore the interpreter can't assume that the .pyc file
contains the code written in the .py file and must then parse and
byte-compile the .py file.



Better a little with righteousness
than much gain with injustice.
        Proverbs 16:8