New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
raw_input
redirection to foreign kernels is extremely brittle
#993
Comments
Can you provide a sample test case? I can't seem to get this to happen. I don't really see how how it could be different if it's 'foreign', because the code doesn't differ at all except for signaling/shutdown. It would make more sense to me if you see the same bad behavior in either console when two are connected to the same kernel, regardless of which owns it. We have a few issues outstanding, which taken together are essentially ' |
I've seen it fairly frequently when doing %debug and walking up/down the stack a few times. It's the behavior we used to see, where the prompt is printed before some output clobbers it. I've put error.py here: https://gist.github.com/1367916 and if I
At the last one, it's wedged: the output came after the prompt, and typing stops working. I think we're going to need some logic where, when |
Sometimes when it gets jammed, I see error messages at the terminal where I started it, along the lines of "position 11232 is beyond usable range". I'll see if I can reproduce it. |
Actually, when it gets jammed, with master, I can press Ctrl-C, and get back to a working IPython shell. That's an improvement on 0.11, where once it's jammed, your shell session is done for. I don't think it's specifically connected to foreign kernels, though - I can get it jammed with a Qt console which started its own kernel normally. |
On Tue, Nov 15, 2011 at 11:15 AM, Thomas
True, though that kills the debug session, for example. Certainly |
Really? I'm quite likely to try Ctrl-C if something's got stuck. I agree, though - it's still far from ideal. |
Well, oddly enough, in the Qt console, I hadn't thought of using Ctrl-C. If one person has a problem, likely others will too :) |
In general, %debug behavior is quite bad in the qtconsole, and I think we Obviously, we should make it harder to get raw_input stuck (I still can't |
I'm not sure that |
Right, but there is a reason that we don't just forward IPython itself as a raw_input REPL. I agree that it certainly shouldn't break like it does, but I do not think that it is reasonable to expect a repl forwarded to the qtconsole to work as well as it does in the terminal. |
Actually, if it's a pure python repl, we might be able to make it work. I'm not completely convinced that we can't make it be robust, but perhaps it really can't be done reliably and we need instead to special-case it... |
Well, the reason we should special case debug is history, tab completion, etc. which are not generic to raw_input requests. A simple repl should probably work, at least if it is sufficiently rudimentary, and if we guarantee that output never gets dumped into the input area, that should go a very long way. I think that is what causes almost all of these problems (raw_input or otherwise). |
Is it possible to maintain a 'stdout point' just before the input prompt, |
That's exactly what the 'before_prompt' bit is supposed to do, but it currently doesn't handle the raw_input (internally identified as |
@minrk, do you think it's easy to adapt the code to handle raw_input as well? It would be awesome if we could make raw_input handling more robust... |
It should be pretty close to just changing this line to I made a couple of tweaks that definitely improve things, but aren't there yet. I don't know the Qt workings well enough to really know where to go from there. The broader issue is that it should really be impossible to accidentally write output to the text entry area. I don't know enough about the Qt text area to know how we can delineate these things better, but rewriting input is so rare, that it should be the only code that can even try to write to the actively edited area. The _append_foo methods should not even be able to do this. |
Agreed. I think @epatters mentioned that since he was using a fully editable widget some of this logic was trickier to implement than if it was a collection of stacked input/output areas (but that would have other issues). But even partial improvements on this front will be super welcome, thanks! |
minor improvements to text placement in qtconsole. This closes ipython#993, and although it's not the long-term implementation we want, it does fix the user-facing problem pretty robustly.
In the notebook, open
%qtconsole
to get a console pointed to the notebook's kernel (which is 'foreign' to the console), then run any script that causes a traceback a few levels deep, and try to run%debug
in the console. In more cases than not, the result is a wedged console where the keyboard stops accepting input.We had major improvements on the raw_input behavior after some fixes made by @epatters to the console, and now it's pretty solid when interacting with its own kernel. But for some reason I don't really understand right now, when talking to kernels it didn't start the behavior is much poorer.
I'm marking it as critical so that at least we have a look at it before 0.12, but if we can't solve it we'll move it to the 0.13 milestone, as it may be harder to fix than we can manage this close to a release, and I don't want to hold 0.12 for any longer than strictly necessary.
The text was updated successfully, but these errors were encountered: