Odd files; just left behind?

Robert Kern robert.kern at gmail.com
Sun Sep 23 03:06:58 CEST 2007

Robin Becker wrote:
> Robert Kern wrote:
> .......
>> They're a cache.
> they're actually the files that get used by the installed extension in 
> this case (MySQLdb).

Yes. They are extracted from the zipfile at runtime and left there so they don't
have to be extracted again. That's why I called it a cache. I didn't mean
anything else by the term.

> ..........
>>> it would seem simpler to have the .so files inside the site-packages and there's 
>>> the question of why this folder has to be obfuscated (name starts with .). Even 
>>> if these files are "resources" why should they be assumed to belong to the user?
>> Because they are unpacked at runtime by the user that imported the module.
>> Usually, they won't have write access to site-packages.
> in this particular case the python being used was installed with a user 
> prefix eg /myhome/PYTHON so everything belongs to the user; extensions 
> installed by the same user can surely be installed in those folders. 
> Upon checking I find that the same installs which produced the 
> ~/.python-eggs files also managed to put  the eggs like 
> MySQL_python-1.2.2-py2.3-freebsd-6.1-SECURITY-i386.egg inside the 
> various site-packages directories.
> I see no reason why the binary resources shouldn't be unpacked to 
> site-packages at install time.

Then do so: Use the -Z argument to easy_install such that it always unpacks the
zip file. If you don't, then the egg will be left zipped, and the resources
extracted at runtime. Zipped eggs have benefits over the unzipped eggs in that
they decrease the amount of import overhead of having many items in your sys.path.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Python-list mailing list