[IPython-user] ipython terminal weirdness

Fernando Perez fperez.net@gmail....
Fri Mar 23 01:37:18 CDT 2007

On 2/7/07, Mikhail Terekhov <termim@gmail.com> wrote:
> On 2/7/07, Fernando Perez <fperez.net@gmail.com> wrote:
> > On 2/7/07, Lev Givon <lev@columbia.edu> wrote:
> > > I have noticed that ipython occasionally appears to derange the
> > > terminal in which it was started insofar that its output no longer
> > > contains any newlines. Resetting the terminal (via !reset) temporarily
> > > clears the problem.
> > >
> > > Is this behavior indicative of some terminal setting misinteraction,
> > > or does it seem like a bug in ipython? I am running ipython 0.7.3 on
> > > Linux; my TERM is set to xterm. I have observed the above behavior in
> > > earlier versions of ipython.
> >
> > I've also seen it on occasion, and I really wish I knew what the hell
> > causes it so I could fix it for good, as it drives me nuts.  But I
> > don't have the foggiest clue as to what actually triggers the problem:
> > it seems pretty random and isn't frequent enough that I've been able
> > figure out what's going on.
> >
> > So if anyone has ideas, I'm all ears...
> >
> >
> It looks like some readline clean up is not done sometimes. It happens all
> the time if you
> run the following script and interrupt it with Cntrl-C:
> # start test.py
> from subprocess import call
> call('ipython')
> # end test.py
> if you re-raise the KeyboardInterrupt exception in InteractiveShell.interact
> (file iplib.py) this dosen't
> happen.

I think this is a different situation than what  Lev originally
reported and that I was referring to.  In your example, you are
nesting one ipython inside another as two supbrocesses both hooked to
the same stdin.  I honestly am not very sure who exactly is supposed
to get the SIGINT in this case.

I see that something very strange happens in this case, and basically
the two nested ipythons start trampling each other (you can see that
by changing the input prompt for one of them).

But unless I've misunderstood what you meant, reraising
KeyboardInterrupt in interact() is not a good idea, since it would
lead to a full ipython exit with Ctrl-C.  Not exactly what we want.

In any case, having nested processes handling the same stdin is not
something I've ever thought of officially supporting.  If someone
knows how to do something like this robustly, and can explain in
particular how SIGINT is supposed to propagate through these
processes, I'd be happy to include improvements.  But this is not
quite the problem we were after in this thread, I'm afraid.

I'd still like to know how to reliably reproduce the problem which Lev
reported, which appears as the input prompts beginning to scroll to
the right and newlines behaving abnormally.



More information about the IPython-user mailing list