Question

IPython is not able to tab-complete the names of modules in the current directory when importing.

If I have a file called Blah.py in the current directory I would like to type (at an ipython prompt) import Bl and have it complete to "import Blah". It seems like nothing happens when I press tab though. Tab completion in other contexts seems to work fine.

I am using EPD 7.2-2 64bit on Mac OSX version 10.5.8. It comes with IPython version 0.12.

This kind of tab completion used to work for me with IPython version 0.10.2 on a Mac (though it wasn't part of EPD). The only other difference I notice in this EPD version is that tab completion also closes the quotes every time you tab-complete a directory name within a string.

Any ideas are appreciated.

Thanks!

Was it helpful?

Solution

The problem is in sys.path. The first entry was an empty string ''. I guess the completer doesn't understand that this means to look in the current directory (maybe it understood in previous versions?). If you add './' to the path then everything works fine.

At the beginning my ipython_config.py file I just added

import sys
sys.path.insert(0, './')

That solves the problem permanently.

OTHER TIPS

Have you got readline installed ?

pip install readline 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top