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

share|improve this question
    
This problem haunted me for sooooo long.... I didn't realized until now, that IPython caused this. Tried "reset", "tput", "shopt -s checkwinsize", reset PS1, tmux resize-pane, escape chars magic, but all in vain. Now I know, that it only occures if IPython has been invoked from TMux, and IPython was killed, or sent to the background (CTRL+Z). – Andor Feb 13 '17 at 12:11
up vote 11 down vote accepted

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
share|improve this answer
    
Make sure you use easy_install, not pip. I tried "pip install readline" and while readline installed, I still had the problem with ipython. I uninstalled, then used easy_install, and problem solved. – Brian Mar 23 '11 at 13:41
1  
Just tried, pip install readline now works just fine and solved the problem for me.. – redShadow May 30 '14 at 14:50
    
On my Linux Mint installation pip install readline required me to first install libncurses with apt-get install libncurses5-dev. – LondonRob Aug 13 '15 at 11:23

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
share|improve this answer
    
My stock Snow Leopard has python2.6.1 and the 2.6.4 version did not work. Also, here's the link to use an alternate mirror since the main pypi is slow lately. sudo easy_install d.pypi.python.org/packages/2.6/r/readline/… – Adam Nelson Aug 3 '10 at 21:07
    
Good points. I should add that I am using the MacPorts version of python -- running 'python_select -s' returns 'python26' instead of 'python26-apple', which shows up in 'python_select -l'. – aam Aug 5 '10 at 20:19

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

ipython up-arrow long line

share|improve this answer
    
:/ That's really annoying, I've tried disabling any profile customisation, using the latest stable version (ipython 0.9.1), two different machines, using different terminal profiles.. What terminal emulator/shell/python/ipython version etc are you using? – dbr Mar 23 '09 at 9:48
    
Never mind the above comment! – dbr Mar 23 '09 at 9:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.