[Distutils] Problem with ihooks: not working as expected in Py25 with eggs?

Phillip J. Eby pje at telecommunity.com
Tue Oct 24 00:12:59 CEST 2006

At 05:11 PM 10/23/2006 +0200, Giovanni Bajo wrote:
> >>> from misc import nobarepyc
> >>> import pkg_resources
>Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\Python25\lib\ihooks.py", line 404, in import_module
>     q, tail = self.find_head_package(parent, str(name))
>   File "C:\Python25\lib\ihooks.py", line 447, in find_head_package
>     raise ImportError, "No module named " + qname
>ImportError: No module named pkg_resources
>*IF* I can read this traceback correctly, this has nothing to do with my own
>hook: it's ihooks itself which appears to be broken with .egg files. Is that
>correct? Does .egg files break ihooks?

If I'm reading it correctly, ihooks expects modules to be files, 
period.  So it's not going to work with any zipfile, let alone eggs.  The 
workaround would be to configure easy_install to --always-unzip when 
installing.  See the manual for details.

(Note that ihooks predates PEP 302 and therefore does not support 
it.  ihooks in fact *replaces* the built-in import mechanism entirely, so 
it's not likely to work correctly with any other PEP 302-based features 
besides eggs.)

More information about the Distutils-SIG mailing list