2

I am new to using IPython 4.0.0 and I am having a problem with tab completion.

At the moment, tab completion works for navigating through my directory structure, but it doesn't work for Python modules etc. If I import numpy and type:

numpy.[tab]

then nothing shows up.

So following the advice on this question: IPython tab completion not working, I installed readline and pyreadline, but it still didn't help. Then I added this code to my startup.py file:

try:
    import readline
except ImportError:
    print("Module readline not available.")
else:
    import rlcompleter
    readline.parse_and_bind("tab: complete")  

Now when I type

numpy.[tab]

it shows me a list of attributes as I would expect. However, now I can't use tab complete to navigate around my directory structure, which is incredibly frustrating. It seems that IPython is meant to have this functionality built in, so can anyone suggest how I might get it working? Cheers

Community
  • 1
  • 1
Pete
  • 103
  • 8
  • Your startup script is probably overriding IPython's completion with the basic Python completer machinery, which is why you don't get filesystem completions. Remove that to try to debug the issue. What OS are you on? – Thomas K Aug 24 '15 at 18:02
  • @Thomas K I am working on Linux. Your suggestion of removing my startup script works. I get filesystem completions and `numpy.[tab]` list the attributes as I would expect. Thanks!! Now to work out which part of the startup script was causing the problem. I assume having a startup script and filesystem completions are not mutually exclusive? – Pete Aug 25 '15 at 09:47
  • Having a startup script is not mutually exclusive with IPython's completions, but setting up completion machinery in a startup script probably replaces IPython's completion system. – Thomas K Aug 26 '15 at 21:12

0 Answers0