dreload produces spurious traceback when numpy is involved
Original report by Robin on the ipython user list is below.
I see the problem by using dreload(), but I can't reproduce it by manually calling the pieces of the code that break in that traceback. Will need to investigate further; there's a slim chance it's a problem in numpy's machinery that tries to detect that it's being imported from the build directory.
# Original report:
From: Robin <email address hidden>
Date: Fri, Dec 5, 2008 at 10:12 AM
Subject: [IPython-user] dreload numpy - source dir error
To: "<email address hidden>" <email address hidden>
I thought I had seen this come up but I can't find it - so sorry if it has...
I have an error using dreload with numpy... I get the error about
importing numpy in the source directory whenever I try to dreload
something that uses numpy. For the most part it does seem to work (I'm
not changing numpy - its my own code I'm trying to dreload) but the
long trace back is a bit annoying because it breaks the list of
results when scrolling through the history...
Anyway here is an example:
robin-mbp:amaripool robince$ ipython
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
Type "copyright", "credits" or "license" for more information.
IPython 0.9.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In : import numpy
In : reload numpy
Out: <module 'numpy' from
In : dreload numpy
ImportError Traceback (most recent call last)
in reload(module, exclude)
--> 181 ret = deep_reload_
157 name = module.__name__
158 if '.' not in name:
--> 159 return import_module(name, name, None)
160 i = name.rfind('.')
161 pname = name[:i]
--> 147 m = imp.load_
149 if fp: fp.close()
119 its source directory; please exit the numpy source
tree, and relaunch
120 your python intepreter from there."""
--> 121 raise ImportError(msg)
122 from version import version as __version__
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python intepreter from there.
|Changed in ipython:|
|status:||New → Triaged|
|importance:||Undecided → Medium|