[IPython-dev] bug report: dreload not working with 'from module import'

Ralf Schmitt ralf at brainbot.com
Mon Sep 22 09:30:47 CDT 2003


Hi,
sorry for posting to the developers mailing list, but using the 
bugtracker wasn't possible (there seems to be no dns entry for 
www.scipy.net).

I have the following package:

ipbug/__init__.py
<empty>
---
ipbug/version.py:
from ipbug.vm import Version

---
ipbug/vm.py:
class Version:
      pass


Starting IPython, importing ipbug.version, and trying to dreload it, 
fails with 'ImportError: No module named ipbug.Version'.
I also wasn't able to checkout the cvs version ('Unknown host 
scipy.org.' after I entered the password), so I have only included a 
traceback for 0.5.0.

Thanks for the fantastic work on IPython,
- Ralf






Python 2.3 (#1, Sep  1 2003, 16:57:54)
Type "copyright", "credits" or "license" for more information.

IPython 0.5.0 -- 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 ipbug.version                       

In [2]: dreload(ipbug.version)
Reloading ipbug.version
Reloading ipbug.ipbug
Reloading ipbug
========== Version ipbug.Version <module 'ipbug' from 'ipbug/__init__.pyc'>
Reloading ipbug.Version
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

/usr/home/ralf/<console>

/usr/local/lib/python2.3/site-packages/IPython/deep_reload.py in 
reload(module,
exclude)
    190     finally:
    191         __builtin__.__import__ = original_import
--> 192         found_now = {}
    193     return ret
    194

/usr/local/lib/python2.3/site-packages/IPython/deep_reload.py in 
deep_reload_hoo
k(module)
    169     pname = name[:i]
    170     parent = sys.modules[pname]
--> 171     return import_module(name[i+1:], name, parent)
    172
    173 # Save the original hooks

/usr/local/lib/python2.3/site-packages/IPython/deep_reload.py in 
import_module(p
artname, fqname, parent)
    155         m = imp.load_module(fqname, fp, pathname, stuff)
    156     finally:
--> 157         if fp: fp.close()
    158        
    159     if parent:

/usr/home/ralf/ipbug/version.py
     -2 from ipbug.vm import Version
     -1

/usr/local/lib/python2.3/site-packages/IPython/deep_reload.py in 
deep_import_hoo
k(name, globals, locals, fromlist)
     50         return q
     51     if hasattr(m, "__path__"):
---> 52         ensure_fromlist(m, fromlist)
     53     return m
     54

/usr/local/lib/python2.3/site-packages/IPython/deep_reload.py in 
ensure_fromlist
(m, fromlist, recursive)
    129             submod = import_module(sub, subname, m)
    130             if not submod:
--> 131                 raise ImportError, "No module named " + subname
    132
    133 # Need to keep track of what we've already reloaded to prevent 
cyclic ev
il

ImportError: No module named ipbug.Version

In [3]:




More information about the IPython-dev mailing list