Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line-wrapping problems with IPython shell

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:

Line wrap issue

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

like image 748
dbr Avatar asked Mar 22 '09 09:03

dbr


3 Answers

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
like image 146
dbr Avatar answered Nov 11 '22 02:11

dbr


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
like image 42
aam Avatar answered Nov 11 '22 04:11

aam


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

ipython up-arrow long line

like image 1
jfs Avatar answered Nov 11 '22 03:11

jfs