[Ipython-tickets] [IPython] #244: deep_import_hook signature is missing a parameter

IPython ipython-tickets@scipy....
Wed Apr 9 10:40:25 CDT 2008


#244: deep_import_hook signature is missing a parameter
---------------------+------------------------------------------------------
 Reporter:  samuel   |       Owner:  fperez
     Type:  defect   |      Status:  new   
 Priority:  normal   |   Milestone:        
Component:  ipython  |     Version:        
 Severity:  normal   |    Keywords:        
---------------------+------------------------------------------------------
 Hi,

 `__import__` in Python 2.5.1 takes an optional fifth "level" argument to
 support absolute/relative imports.  iPython's `deep_import_hook` doesn't
 accept this, which causes problems when absolute imports are enabled.

 Regards,

 Alex

 {{{
 $ cat foo.py
 from __future__ import absolute_import


 $ ipython
 Python 2.5.1 (r251:54863, Oct 30 2007, 15:10:13)
 Type "copyright", "credits" or "license" for more information.

 IPython 0.8.1 -- An enhanced Interactive Python.
 ?       -> Introduction to IPython's features.
 %magic  -> Information about IPython's 'magic' % functions.
 help    -> Python's own help system.
 object? -> Details about 'object'. ?object also works, ?? prints more.

 In [1]: import foo

 In [2]: dreload(foo)
 Reloading foo
 ---------------------------------------------------------------------------
 <type 'exceptions.TypeError'>             Traceback (most recent call
 last)

 /u/samuela/tmp/ip/<ipython console> in <module>()

 /usr/local/python-2.5.1/lib/python2.5/site-
 packages/ipython-0.8.1-py2.5.egg/IPython/deep_reload.py in reload(module,
 exclude)
     176     __builtin__.__import__ = deep_import_hook
     177     try:
 --> 178         ret = deep_reload_hook(module)
     179     finally:
     180         __builtin__.__import__ = original_import

 /usr/local/python-2.5.1/lib/python2.5/site-
 packages/ipython-0.8.1-py2.5.egg/IPython/deep_reload.py in
 deep_reload_hook(module)
     154     name = module.__name__
     155     if '.' not in name:
 --> 156         return import_module(name, name, None)
     157     i = name.rfind('.')
     158     pname = name[:i]

 /usr/local/python-2.5.1/lib/python2.5/site-
 packages/ipython-0.8.1-py2.5.egg/IPython/deep_reload.py in
 import_module(partname, fqname, parent)
     142
     143     try:
 --> 144         m = imp.load_module(fqname, fp, pathname, stuff)
     145     finally:
     146         if fp: fp.close()

 /u/samuela/tmp/ip/foo.py in <module>()
 ----> 1 from __future__ import absolute_import

 <type 'exceptions.TypeError'>: deep_import_hook() takes at most 4
 arguments (5 given)

 }}}

-- 
Ticket URL: <http://ipython.scipy.org/ipython/ipython/ticket/244>
IPython <http://ipython.scipy.org>
The IPython interactive Python system


More information about the Ipython-tickets mailing list