[Distutils] requiring python 2.5

Phillip J. Eby pje at telecommunity.com
Fri Jun 15 04:05:43 CEST 2007


At 06:25 PM 6/14/2007 -0500, Rick Ratzel wrote:


>    Arg...I thought I had this working, but it turns out I had a 
> setuptools 0.7
>dev release installed.  When I go to a setuptools 0.6 release, I get the same
>old problem.  Here are more details...
>
>    Enstaller is started with a script generated when easy_install 
> installs the
>egg, so right away pkg_resources is imported and I have no chance to 
>do anything
>before.  I put the following in enstaller's __init__.py as recommended:
>
>from os import path
>import enthought
>enthought.__path__ = [path.dirname( path.dirname( __file__ ) )]
>
>    and confirmed that it is indeed setting the __path__ for 
> enthought correctly
>with a "print enthought.__path__" in another enstaller module imported later,
>which produced:
>
>['c:\\python25\\lib\\site-packages\\enstaller-2.1.0b1-py2.5-win32.egg\\enthought']
>
>    This is compared to the two screenfuls of 'enthought.' paths without that
>code.  As mentioned, this works great for setuptools 0.7, but as soon as I
>switch out 0.7 for 0.6, I get ImportErrors from package mismatches as python
>finds other incompatible 'enthought.' packages on the system instead 
>of the ones
>bundled in the enstaller egg.

It sounds like the other paths are being added (again) to __path__ 
later.  This should only happen if new eggs get require()'d or 
otherwise added to the working set.  Can you narrow down where this 
is happening?

Is it possible, for example, that enstaller is being imported while 
pkg_resources is being imported?  If you could raise an exception at 
the point of setting __path__, what is the full traceback?  Likewise, 
what is the full traceback of the import errors you're getting?

(Also, perhaps you could try setting __path__ to a tuple instead of a 
list?  I'm not sure if that would work, but if it does, then an 
exception would occur when any other code modifies the __path__, so 
that might be another way to track it down.  Full traceback, please, 
if this works...)



More information about the Distutils-SIG mailing list