A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ipython/ipython/issues/32/ below:

dreload produces spurious traceback when numpy is involved · Issue #32 · ipython/ipython · GitHub

Original Launchpad bug 306805: https://bugs.launchpad.net/ipython/+bug/306805
Reported by: fdo.perez (Fernando Perez).

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 robince@gmail.com
Date: Fri, Dec 5, 2008 at 10:12 AM
Subject: [IPython-user] dreload numpy - source dir error
To: "ipython-user@scipy.org" ipython-user@scipy.org

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]: 
In [3]: dreload numpy
------> dreload(numpy)
Reloading numpy
Reloading numpy.numpy
Reloading numpy.show
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

/Users/robince/phd/amaripool/ in ()

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ipython-0.9.1-py2.5.egg/IPython/deep_reload.pyc
in reload(module, exclude)
   179     __builtin__.__import__ = deep_import_hook
   180     try:
--> 181         ret = deep_reload_hook(module)
   182     finally:
   183         __builtin__.__import__ = original_import

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ipython-0.9.1-py2.5.egg/IPython/deep_reload.pyc
in deep_reload_hook(module)
   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/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ipython-0.9.1-py2.5.egg/IPython/deep_reload.pyc
in import_module(partname, fqname, parent)
   145
   146     try:
--> 147         m = imp.load_module(fqname, fp, pathname, stuff)
   148     finally:
   149         if fp: fp.close()

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/__init__.pyc
in ()
   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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4