-
Notifications
You must be signed in to change notification settings - Fork 147
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
Output not visible inside IPython notebook #52
Output not visible inside IPython notebook #52
Comments
This also seems to be the case with |
Thank for the nice workaround! But is there meanwhile a better solution? |
Should be fixed by 9b2f0e5 |
So how do I get ipython notebook to break where I want it to? I love my notebook and %debug is fab but need more |
Guys, I can see the fix in ipdb, but it tests against nose having been loaded and when I'm running ipython notebooks nose modules are in fact loaded, so the output still redirects to the console in which the notebook is running rather than the notebook itself. I've commented out the fix locally (where the code runs the test 'if 'nose' in sys.modules.keys():' prior to defining io.stdout so that io.stdout is not redefined: if 'nose' in sys.modules.keys():
def update_stdout():
# setup stdout to ensure output is available with nose
# io.stdout = sys.stdout = sys.__stdout__
pass This does work in my local installation, but likely causes issues with nose tests, which was the initial source of this particular bug. I could very well be doing something wrong with ipython on my end, it's a stock installation via brew on yosemite, using the latest ipython and ipdb code installed via pip. |
Hey guys, this still exists and should be re-opened. |
To update, ipython is not loading nose, Theano is. I've opened the above ticket with them. That said, I'm not sure that the current implementation is the best solution to this issue in ipdb either. |
@cclamb Can you expand what you mean bout the current implementation ? |
Sure, sorry about being unclear. My impression is that the original fix to help with nose test output was to change the stdout pointer: def update_stdout():
# setup stdout to ensure output is available with nose
io.stdout = sys.stdout = sys.__stdout__ When that was found to cause problems in some cases (specifically with ipython notebooks), it was changed to this: if 'nose' in sys.modules.keys():
def update_stdout():
# setup stdout to ensure output is available with nose
io.stdout = sys.stdout = sys.__stdout__
else
def update_stdout():
pass When I say the current implementation, I mean that perhaps another fix that doesn't require contextual stdout shifting might work better. Theano's a really popular library for notebook users, and even though arguably they should not be loading nose, perhaps a fix that depends on evaluating the runtime environment in this way may be more brittle than you'd like. That said, I don't know ipdb well enough to suggest an alternative, so feel free to be a bit skeptical of my input here. |
@cclamb Thanks for the detailed explanation. I agree with what you state. I was actually hoping you would already have a better idea. I'll dig deeper. |
+1 |
Can you try code from #84 ? The README explains how to explicitly ask for stdout fiddling: https://github.com/gotcha/ipdb/tree/fix_stdout#issues-with-stdout |
Just to clarify, this is still a problem for me when running
The ZeroDivisionError exception isn't printed, only after the fact when I hit
I have I've tried commenting out the I'm running the latest ipdb 0.10.2 installed via pip, in Xubuntu 16.04. I feel like this only became a problem for me recently, perhaps after moving from IPython 4 to 5, but I might be wrong about that. |
When
ipdb.set_trace()
is called, it calls this function:This results in output being written back to the terminal where the notebook was launched, instead of appearing in the notebook itself. It will do the wrong thing in any context where you want the output to be redirected. Commenting out the call to this function makes it behave as expected.
I'm not sure what's the right heuristic to guess whether output should be redirected or not.
Reported as ipython/ipython#5247.
The text was updated successfully, but these errors were encountered: