I'm using the EPD version of python and IPython. After installing some modules using easy_install I notice that, although they can be imported, they cannot be tab completed. They exist on the path but, while included modules (pylab, readline, math) can be completed, these new modules cannot.
Anyone know what I should look into to find the problem? I've checked that the packages are in the same place as other modules:
In [1]: import pylab
In [2]: pylab
Out[2]: <module 'pylab' from '/Library/Frameworks/Python.framework/Versions/5.0.0/lib/python2.5/site-packages/pylab.pyc'>
In [3]: import BeautifulSoup
In [4]: BeautifulSoup
Out[4]: <module 'BeautifulSoup' from '/Library/Frameworks/Python.framework/Versions/5.0.0/lib/python2.5/site-packages/BeautifulSoup-3.1.0.1-py2.5.egg/BeautifulSoup.pyc'>
Maybe something not handling the .eggs
correctly? Thanks.
Update: Following up on gnibbler's post, I've found that the tab completion hits an exception at line 633 in completer.py at:
try:
ret = self.matches[state].replace(magic_prefix,magic_escape)
return ret
except IndexError:
return None
But what is causing the failiure...
Update:
In [5]: from Bea<tab_here>
*** COMPLETE: <Bea> (0)
matches: []
state: 0
So this is just saying that the matches list is an empty set: there are no matches. It is still not finding the module. I'll try to investigate where matches
is getting the modules its looking for when I have time.
I found an answer to this question yesterday, after I got tired of this behavior.
It seems that IPython has a simple database with all the modules it can find in
sys.path
. Every time you install a new module you have to write the magicso that IPython regenerates its database. Then you can have TAB-completion of new modules.
Locally installed, non-egg modules can have their name tab-completed, when doing
import
, but egg modules cannot (IPython 0.10, Python 2.6.2, Mac OS X).I would suggest to file a feature request / bug report with IPython!
right at the end of Ipython/completer.py is this code:
Perhaps uncommenting it will give you a clue