dreload produces spurious traceback when numpy is involved
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
Invalid
|
Medium
|
Unassigned |
Bug Description
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>
Hi,
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 [1]: import numpy
In [2]: reload numpy
------> reload(numpy)
Out[2]: <module 'numpy' from
'/Library/
In [3]: dreload numpy
------> dreload(numpy)
Reloading numpy
Reloading numpy.numpy
Reloading numpy.show
-------
ImportError Traceback (most recent call last)
/Users/
/Library/
in reload(module, exclude)
179 __builtin_
180 try:
--> 181 ret = deep_reload_
182 finally:
183 __builtin_
/Library/
in 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]
/Library/
in import_
145
146 try:
--> 147 m = imp.load_
148 finally:
149 if fp: fp.close()
/Library/
in <module>()
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__
123
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.
Cheers
Robin
Changed in ipython: | |
status: | New → Triaged |
importance: | Undecided → Medium |
This is happening for me as well in 0.10 - it's pretty annoying in that it renders dreload (a very useful function) essentially useless. It doesn't even work to do dreload( somemodulethatu sesnumpy, exclude= ['numpy' ,'numpy. numpy', 'numpy. show'])