[Distutils] [Python-Dev] PEP 365 (Adding the pkg_resources module)

Marius Gedminas marius at pov.lt
Wed Mar 19 20:52:57 CET 2008


On Wed, Mar 19, 2008 at 03:37:59PM -0400, Jim Fulton wrote:
> On Mar 18, 2008, at 2:51 PM, Marius Gedminas wrote:
> ...
> >os.path.join(os.path.dirname(__file__), 'foo') just has too many
> >problems.
> 
> Could you be specific?

I suppose I was thinking about the stale .pyc file problem, mostly.

zc.buildout/setuptools/distutils (I'm not sure which part of the stack
is to blame) likes to compile modules in a temporary directory and then
move the .py and .pyc files to their final location.  As a result,
__file__ points to the now-nonexistent directory.

Aside: I never understood the reason for storing the value of __file__
in the .pyc/.pyo file itself.  Why not set it to the correct value on
import time?

Marius Gedminas
-- 
If you have to run heating in winter, you don't own enough computers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20080319/bd0f4445/attachment.pgp 


More information about the Distutils-SIG mailing list