I recently upgraded to python2.7 and noticed that th开发者_开发问答e 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.
精彩评论