egg and modpython

Bruno Desthuilliers onurb at xiludom.gro
Tue Sep 12 04:26:08 EDT 2006


Paul Boddie wrote:
> Bruno Desthuilliers wrote:
>> Wensheng a écrit :
>>> I installed pysqlite2 using easy_install.
>>> and got this when using it from modpython:
>>> --------------------------------------------------------------------------------------------------
>>> Mod_python error: "PythonHandler etc.modpython"
> 
> [...]
> 
> I applaud you for studying the traceback in more depth than I can find
> the motivation for, Bruno. ;-) However, this looks like a program using
> some package installed by setuptools/easy_install needs to unpack that
> package when running.

Yes, this is explained in the doc. Pure Python eggs can run from zipped
files, but when there's a binary extension it has to be unzipped. The
OP's problem is that the PYTHON_EGG_CACHE env points to a directory not
writable for the user account. The two obvious solutions are to change
this env variable or reinstall the egg with the appropriate flag to
avoid installing it as a zipped egg.


>>> ExtractionError: Can't extract file(s) to egg cache
>>> The following error occurred while trying to extract file(s) to the
>>> Python egg cache:
>>>   [Errno 13] Permission denied: '/var/www/.python-eggs'
> 
> And this wants to happen apparently in the home directory of the Web
> server user, whose rights may be somewhat limited. Or perhaps one has
> to initialise setuptools for any particular user by running it first as
> that user:

No, it's just a matter of specifying another value for the PYTHON_EGG_CACHE.

> 
> [...]
> 
>>> Can peak developers fix this please?
>> Why should they "fix" something that's
>> 1/ documented
>>     -> http://peak.telecommunity.com/DevCenter/EggFormats#zip-file-issues
> 
> "The Internal Structure of Python Eggs / STOP! This is not the first
> document you should read!"

That doesn't mean you should not read it.

> A case of "Beware of the Leopard" perhaps?

!-)

>> 2/ not a an egg specific issue
> 
> In my experience, most other package managers actually unpack their
> resources when invoked, rather than leaving the programs to attempt
> such things when running.

eggs are the Python's equivalent to Java's JAR, not a RPM-like. I said
it was not an egg-specific issue (which is not totally accurate) because
it mostly have to do with loading dynamic libs (.so, .dll etc) from
zipped files.

> Debian packages even compile the bytecode
> files to ensure that nothing tries (and fails) to write them to
> privileged locations afterwards.

So does eggs. But once again, eggs are *not* a general-purpose package
management system like apt, RPM, emerge etc...

(snip)
> This situation looks either a lot like a use case whose popularity has
> been underestimated by the developers - intriguing given the number of
> people supposedly using setuptools for their Web application
> deployments - or a packaging mistake with the pysqlite2 .egg file.

My VHO is that eggs needing to extract some of their content should not
be packaged as zip-safe.


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list