[IPython-user] dreload numpy issue

belinda thom bthom at cs.hmc.edu
Wed Jan 10 23:09:54 CST 2007


Hi,

I'm re-entering this problem that I reported earlier (http:// 
projects.scipy.org/pipermail/ipython-user/2007-January/003984.html)  
because the subject line was derived from an email that served a  
different purpose and I've not heard a reply. No hurry, but I would  
like it "on the books". :-)

I cannot dreload pylab or numpy, nor files that contain these  
imports. I've tried using the exclude= option in several ways to no  
avail, e.g. for file pyload.py, which contains an import pylab inside:

dreload(pyload)
dreload(pyload,exclude='pylab')
dreload(pyload,exclude=['pylab'])

all throw errors (appended)

It seems the default list should contain these files as well, since  
they (obviously?) mess up some kinds of hooks.

In [7]: dreload??
Source:
[snip]
def reload(module, exclude=['sys', '__builtin__', '__main__']):
     """Recursively reload all modules used in the given module.   
Optionally
     takes a list of modules to exclude from reloading.  The default  
exclude
     list contains sys, __main__, and __builtin__, to prevent, e.g.,  
resetting
     display, exception, and io hooks.
     """

In the very least, if this behavior is expected, then others might  
save some time if they find this post.

Thanks,

--b

=======================

70 % ipython -pylab
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.4.svn.r2010 -- An enhanced Interactive Python.

In [1]: import pyload
In [3]: dreload(pyload)
Reloading pyload
Reloading pylab
[snip]
Reloading exceptions
------------------------------------------------------------------------ 
---
exceptions.ImportError                               Traceback (most  
recent call last)

/Users/bthom/belinda/mills/aicourse/python_exs/<ipython console>

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/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/deep_reload.py in deep_reload_hook(module)
[snip]
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
shutil.py
       9 import stat
      10 import exceptions
---> 11 from os.path import abspath
      12
      13 __all__ =  
["copyfileobj","copyfile","copymode","copystat","copy","copy2",

ImportError: cannot import name abspath



More information about the IPython-user mailing list