[Python-Dev] how to easily consume just the parts of eggs that are good for you

Phillip J. Eby pje at telecommunity.com
Wed Apr 9 22:06:14 CEST 2008


At 12:30 PM 4/9/2008 -0700, zooko wrote:

>On Apr 8, 2008, at 4:36 PM, Greg Ewing wrote:
> >
> > I discovered another annoyance with eggs the other day -- it
> > seems that tracebacks referring to egg-resident files contain the
> > pathname of some temporary directory that existed when the egg
> > was being packaged, rather than the one it actually exists in
> > at run time.
>
>Brian Warner and I discovered that issue yesterday, too.  We
>determined that if you install the egg (with easy_install or with a
>setuptools-powered ./setup.py install) in unzipped form then the
>source file names get rewritten so that your stack traces come with
>source lines.

Are you using Python 2.5?  As of 2.5, the linecache module should 
correctly read the source line from the present location of the 
source file the module was loaded from, regardless of the file name 
specified in the traceback.


>If you have a package which requires stack traces to come with source
>lines, then you could pass "zip_safe=False" to the call to setup().
>
>I would prefer that zip_safe=False were the default and that either
>the producer or the consumer of a package had to specifically choose
>zip_safe=True in order to install eggs in zipped form.

A better fix would be for Python to use relative paths in 
co_filename, as this would fix similar problems that occur whenever 
you move .pyc/.pyo files around.



More information about the Python-Dev mailing list