문제

I recently upgraded to python2.7 and noticed that the tab key does not function appropriately in the shell. Instead, it appears to search through the underlying directory (the standard unix behavior).

If I change back over to python2.6, it works appropriately. Is there a way to add this functionality back to 2.7?

For example:

if foo:
(tab here) print 'bar' #desired behavior is that tab key adds indentation here

Solution:
This is a known issue with python2.7 on Mac OSX. I used the following workaround to correct it:

$ cat > $HOME/.pystartup
import readline
if 'libedit' in readline.__doc__:
   readline.parse_and_bind("bind ^I ed-insert")
^D
$ export PYTHONSTARTUP=$HOME/.pystartup
도움이 되었습니까?

해결책

This is a known bug with python 2.7 on Mac OSX. More details (including a fix) can be found in the bug report.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top