Line-wrapping problems with IPython shell

 ̄綄美尐妖づ 提交于 2019-12-09 14:32:44

问题


If I have run a long line in IPython, and try and recall it (using the up-arrow) or backspace beyond the start of the current line, it displays incorrectly (all smushed into one line)

For example, in the following session I wrote a long line [1], entered a somewhat-blank line [2], then up-arrowed twice to get the print statement on line [3], and the following happened:

Happens in both iTerm and Terminal.app.. I had a similar problem with regular terminal sessions, which was fixed by properly terminating colour codes, but I'm not sure how to fix it with IPython


回答1:


Aha! I had an old version of the Python readline module - installing the latest from http://ipython.scipy.org/dist/ and it works perfectly!

sudo easy_install http://ipython.scipy.org/dist/readline-2.5.1-py2.5-macosx-10.5-i386.egg



回答2:


Got this problem on Snow Leopard. Installing a new version of readline from http://pypi.python.org/pypi/readline/ fixes it:

sudo easy_install http://pypi.python.org/packages/2.6/r/readline/readline-2.6.4-py2.6-macosx-10.6-universal.egg



回答3:


I can't reproduce it (up-arrow works for long lines in ipython):



来源:https://stackoverflow.com/questions/670764/line-wrapping-problems-with-ipython-shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!