IPython tab complements only some modules

I am using the EPD version of python and IPython. After installing some modules with easy_install, I noticed that although they can be imported, they cannot be completed. They exist on the way, but if modules (pylab, readline, math) are included, these new modules cannot.

Does anyone know what I should study to find the problem? I checked that the packages are in the same place as the 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'> 

Perhaps something is not handling .eggs ? Thank.

Refresh . After a gnibbler message, I found that tab completion throws an exception on line 633 in completeter.py:

  try: ret = self.matches[state].replace(magic_prefix,magic_escape) return ret except IndexError: return None 

But what causes the failure ...

Update :

 In [5]: from Bea<tab_here> *** COMPLETE: <Bea> (0) matches: [] state: 0 

So, it just says that the hit list is an empty set: there are no matches. He still cannot find the module. I will try to figure out where matches gets the modules they are looking for when I have time.

+6
python module tab-completion ipython enthought
12 Oct '09 at 6:05
source share
3 answers

I found the answer to this question yesterday, after I was tired of this behavior.

IPython seems to have a simple database with all the modules that it can find in sys.path . Every time you install a new module, you need to write magic

 In [1]: %rehashx 

so that IPython restores its database. Then you can have the TAB completion of the new modules.

+11
02 Sep 2018-10-21T00:
source share

right at the end of Ipython / completeter.py is the code:

 except: #from IPython.ultraTB import AutoFormattedTB; # dbg #tb=AutoFormattedTB('Verbose');tb() #dbg 
# If completion fails, don't annoy the user. return None

Perhaps uncommenting will give you a hint

+2
Oct 12 '09 at 6:20
source share

Locally installed egg-free modules may have their own tab-completed name when import , but egg modules cannot (IPython 0.10, Python 2.6.2, Mac OS X).

I would suggest recording a function request / error report using IPython!

0
Oct 12 '09 at 7:35
source share



All Articles