[IPython-User] readline freakout

Fernando Perez fperez.net@gmail....
Sun Aug 21 20:22:40 CDT 2011

Hi Neil,

On Sun, Aug 14, 2011 at 10:07 AM, neil rabinowitz
<neil.rabinowitz@merton.ox.ac.uk> wrote:
> hi
> i have a rather specific problem with an unknown etiology. basically, while
> using the ipython terminal, after some time the readline keybindings stop
> working. so, for example, Ctrl-A/E no longer goes to the start/end of the
> line, and Ctrl-R no longer allows reverse-i-search. the only way i can solve
> this is by quitting the terminal and restarting.
> i recall this being a problem on ipython 0.10 as well. to be honest, i have
> no idea if it's an ipython or a python problem. i know this happens to me on
> at least two machines, both of which are running ubuntu (one 10.04 with
> python 2.6.5, the other 11.04 with python 2.7.1+), via gnome-terminal.
> if anyone has any pointers for figuring out why this might happen, they'd be
> appreciated. i have a hunch that it may happen after a botched
> tab-completion, but i'm not confident that this is the case. alternatively
> -- if someone knows a way of restarting readline (or whatever else is
> responsible) from within a session, this may also help.

The lack of reply is probably a sign that nobody else knows what to do
here, it's a rather obscure issue.

I haven't seen similar problems in a very long time, but years ago I
used to.  If I recall correctly, issuing


at the ipython prompt could help (though I could be wrong).

It seems like the problem always appeared due to something going wrong
internally after using the pager to display something.  We do have a
few curses calls in there to detect window size, and I remember fixing
some problems that helped reduce/eliminate these misbehaviors later
on.  But there could be corner cases left.

On the other hand, this could be a separate issue: your hunch that it
has to do with tab completion may be on to something.  In that case,
though, it's likely to be a bug in readline itself, either in the
python readline.c module or even perhaps in GNU readline proper
(though that's less likely).  It's quite possible that a failed
completion of a certain nature leaves the python readline module
wedged in a bad state.

If using the !reset trick doesn't help, then my vote is for a readline
bug.  Likely not something in ipython, it's just that we use readline
so heavily that we often expose bugs in it.



More information about the IPython-User mailing list