[IPython-user] ipython / namespace qn

belinda thom bthom at cs.hmc.edu
Fri Jan 5 02:35:45 CST 2007


p.s. I should add that when I try to dreload a file that contains:

from numpy import N
from pylab import P

I get the following behavior:

In [47]: dreload bthom.utils
-------> dreload(bthom.utils)
Reloading bthom.utils
Reloading bthom.numpy
Reloading numpy
Reloading numpy.__config__
Reloading numpy.version
Reloading numpy.os
Reloading os
Reloading posix
Reloading posixpath
Reloading stat
Reloading UserDict
Reloading copy_reg
Reloading types
Reloading numpy.imp
Reloading imp
Reloading numpy._import_tools
Reloading numpy.sys
Reloading numpy.glob
Reloading glob
Reloading fnmatch
Reloading re
Reloading sre
Reloading sre_compile
Reloading _sre
Reloading sre_constants
Reloading sre_parse
Reloading numpy.testing
Reloading numpy.testing.info
Reloading numpy.testing.numpytest
Reloading numpy.testing.os
Reloading numpy.testing.re
Reloading numpy.testing.sys
Reloading numpy.testing.imp
Reloading numpy.testing.glob
Reloading numpy.testing.types
Reloading numpy.testing.unittest
Reloading unittest
Reloading time
Reloading traceback
Reloading linecache
Reloading numpy.testing.traceback
Reloading numpy.testing.utils
Reloading numpy.testing.operator
Reloading operator
Reloading numpy.core
Reloading numpy.core.info
Reloading numpy.core.numpy
Reloading numpy.core.multiarray
Reloading numpy.core.umath
Reloading numpy.core.numerictypes
Reloading numpy.core.types
Reloading numpy.core.__builtin__
Reloading numpy.core._sort
Reloading numpy.core.numeric
Reloading numpy.core.sys
Reloading numpy.core._dotblas
Reloading numpy.core.arrayprint
Reloading numpy.core.fromnumeric
Reloading numpy.core.cPickle
Reloading cPickle
Reloading numpy.core.defmatrix
Reloading numpy.core.string
Reloading string
Reloading strop
Reloading numpy.core.ma
Reloading numpy.core.warnings
Reloading warnings
Reloading numpy.core.defchararray
Reloading numpy.core.records
Reloading numpy.core.os
Reloading numpy.core.memmap
Reloading numpy.core.mmap
Reloading mmap
Reloading numpy.core.scalarmath
Reloading numpy.lib
Reloading numpy.lib.info
Reloading numpy.lib.numpy
Reloading numpy.lib.type_check
Reloading numpy.lib.ufunclike
Reloading numpy.lib.index_tricks
Reloading numpy.lib.sys
Reloading numpy.lib.types
Reloading numpy.lib.function_base
Reloading numpy.lib._compiled_base
Reloading numpy.lib.arraysetops
Reloading numpy.lib.time
Reloading numpy.lib.re
Reloading numpy.lib.warnings
Reloading numpy.lib.shape_base
Reloading numpy.lib.twodim_base
Reloading numpy.lib.scimath
Reloading numpy.lib.polynomial
Reloading numpy.lib.machar
Reloading numpy.lib.getlimits
Reloading numpy.lib.utils
Reloading numpy.lib.os
Reloading numpy.lib.inspect
Reloading inspect
Reloading dis
Reloading opcode
Reloading tokenize
Reloading token
Reloading numpy._flagdict
------------------------------------------------------------------------ 
---
exceptions.ImportError                               Traceback (most  
recent call last)

/Users/bthom/bin/python/bthom/<ipython console>

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.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

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
deep_reload_hook(module)
     158     pname = name[:i]
     159     parent = sys.modules[pname]
--> 160     return import_module(name[i+1:], name, parent)
     161
     162 # Save the original hooks

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.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()

/Users/bthom/bin/python/bthom/utils.py
       2 various useful utilities
       3 """
----> 4 import numpy as N
       5 import pylab as P
       6 import os

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
deep_import_hook(name, globals, locals, fromlist)
      35 def deep_import_hook(name, globals=None, locals=None,  
fromlist=None):
      36     parent = determine_parent(globals)
---> 37     q, tail = find_head_package(parent, name)
      38     m = load_tail(q, tail)
      39     if not fromlist:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
find_head_package(parent, name)
      80         qname = head
      81         parent = None
---> 82         q = import_module(head, qname, parent)
      83         if q: return q, tail
      84     raise ImportError, "No module named " + qname

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.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()

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/numpy/__init__.py
      36     import core
      37     from core import *
---> 38     import lib
      39     from lib import *
      40     import linalg

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
deep_import_hook(name, globals, locals, fromlist)
      35 def deep_import_hook(name, globals=None, locals=None,  
fromlist=None):
      36     parent = determine_parent(globals)
---> 37     q, tail = find_head_package(parent, name)
      38     m = load_tail(q, tail)
      39     if not fromlist:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
find_head_package(parent, name)
      75     else:
      76         qname = head
---> 77     q = import_module(head, qname, parent)
      78     if q: return q, tail
      79     if parent:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.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()

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/numpy/lib/__init__.py
      15 from getlimits import *
      16 #import convertcode
---> 17 from utils import *
      18 from arraysetops import *
      19 import math

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
deep_import_hook(name, globals, locals, fromlist)
      35 def deep_import_hook(name, globals=None, locals=None,  
fromlist=None):
      36     parent = determine_parent(globals)
---> 37     q, tail = find_head_package(parent, name)
      38     m = load_tail(q, tail)
      39     if not fromlist:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
find_head_package(parent, name)
      75     else:
      76         qname = head
---> 77     q = import_module(head, qname, parent)
      78     if q: return q, tail
      79     if parent:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.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()

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/numpy/lib/utils.py
       3 import types
       4 from numpy.core.numerictypes import obj2sctype, integer,  
generic
----> 5 from numpy.core.multiarray import dtype as _dtype, _flagdict,  
flagsobj
       6 from numpy.core import product, ndarray
       7

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
deep_import_hook(name, globals, locals, fromlist)
      40         return q
      41     if hasattr(m, "__path__"):
---> 42         ensure_fromlist(m, fromlist)
      43     return m
      44

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py in  
ensure_fromlist(m, fromlist, recursive)
     118             submod = import_module(sub, subname, m)
     119             if not submod:
--> 120                 raise ImportError, "No module named " + subname
     121
     122 # Need to keep track of what we've already reloaded to  
prevent cyclic evil

ImportError: No module named numpy._flagdict
 > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/ipython-0.7.3-py2.4.egg/IPython/deep_reload.py(120) 
ensure_fromlist()
     119             if not submod:
--> 120                 raise ImportError, "No module named " + subname
     121

ipdb>


More information about the IPython-user mailing list