[Python-Dev] knee.py import hook in 2.6

Timothy D. Kadich 98k.master at gmail.com
Tue Jul 19 20:16:46 CEST 2011


Hi,

I'm trying to use the import hook in Python2.6, but I'm having a problem. It
doesn't work for numpy. My error is such:

> >>> import knee
> >>> import numpy
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "knee.py", line 16, in import_hook
>     q, tail = find_head_package(parent, name)
>   File "knee.py", line 52, in find_head_package
>     q = import_module(head, qname, parent)
>   File "knee.py", line 101, in import_module
>     m = imp.load_module(fqname, fp, pathname, stuff)
>   File "/usr/apps/python2.6/lib/python2.6/site-packages/numpy/__init__.py",
> line 130, in <module>
>     import add_newdocs
>   File "knee.py", line 16, in import_hook
>     q, tail = find_head_package(parent, name)
>   File "knee.py", line 52, in find_head_package
>     q = import_module(head, qname, parent)
>   File "knee.py", line 101, in import_module
>     m = imp.load_module(fqname, fp, pathname, stuff)
>   File
> "/usr/apps/python2.6/lib/python2.6/site-packages/numpy/add_newdocs.py", line
> 9, in <module>
>     from lib import add_newdoc
>   File "knee.py", line 16, in import_hook
>     q, tail = find_head_package(parent, name)
>   File "knee.py", line 52, in find_head_package
>     q = import_module(head, qname, parent)
>   File "knee.py", line 101, in import_module
>     m = imp.load_module(fqname, fp, pathname, stuff)
>   File
> "/usr/apps/python2.6/lib/python2.6/site-packages/numpy/lib/__init__.py",
> line 4, in <module>
>     from type_check import *
>   File "knee.py", line 16, in import_hook
>     q, tail = find_head_package(parent, name)
>   File "knee.py", line 52, in find_head_package
>     q = import_module(head, qname, parent)
>   File "knee.py", line 101, in import_module
>     m = imp.load_module(fqname, fp, pathname, stuff)
>   File
> "/usr/apps/python2.6/lib/python2.6/site-packages/numpy/lib/type_check.py",
> line 8, in <module>
>     import numpy.core.numeric as _nx
>   File "knee.py", line 17, in import_hook
>     m = load_tail(q, tail)
>   File "knee.py", line 68, in load_tail
>     m = import_module(head, mname, m)
>   File "knee.py", line 101, in import_module
>     m = imp.load_module(fqname, fp, pathname, stuff)
>   File
> "/usr/apps/python2.6/lib/python2.6/site-packages/numpy/core/__init__.py",
> line 6, in <module>
>     import umath
>   File "knee.py", line 16, in import_hook
>     q, tail = find_head_package(parent, name)
>   File "knee.py", line 52, in find_head_package
>     q = import_module(head, qname, parent)
>   File "knee.py", line 101, in import_module
>     m = imp.load_module(fqname, fp, pathname, stuff)
> TypeError: import_hook() takes at most 4 arguments (5 given)



So I don't know what is going on, unless a "self" is being passed along the
way. (which seems like it could happen when looking at __import__ in the
source)
Can any of you identify my problem or let me know of a fixed import hook?

Thank you,
Timothy D. Kadich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110719/b0f06d8c/attachment.html>


More information about the Python-Dev mailing list