-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 of C extensions is not shown in IPython console #3777
Comments
@minrk or @takluyver, is there a configuration setting we can change in qtconsole to redirect stdout/stderr of all C extensions to the zmq corresponding channel? |
There isn't a config setting, but you can use Min's package wurlitzer in the kernel. Once we implement the kernel nanny proposal, we'll be able to capture this kind of output automatically. |
Thanks a lot Thomas! We'll use wurlitzer in the meantime :-)
This seems more and more important for Spyder. What are your plans about it? Do you have a time frame for it? I say it because we have now 4 new junior developers working for Spyder, so I could assign some of them to work on this project (under your guidance and my supervision, of course :-). |
We discussed it again at the dev meeting, but there isn't an explicit time frame. The primary sticking point for me is that we still don't have a firm decision on whether we use one nanny process for one kernel, or one nanny process per system, managing multiple kernels. |
Ok, thanks. Please let me know if you need some help with that :-) |
Another example that does not generate output in the spyder3 with the ipython console
|
Any update on this issue? I'd like to get tensorflow logs in my console... |
I need this feature, please? |
Sorry, we haven't worked on this one yet. We could work on it after we release 3.3 though. |
I had a quick try. It is easy to change spyder-kernels to load the wurlitzer extension on startup and this does the job: Normally, the output "bla" of the echo command is lost. There is a slight difference with running python from the console, in that IPython run from Spyder forwards the output through Python's sys.stdout while when running python from the console, the output is interspersed with python's output without going through sys.stdout (if I understand it correctly). Nevertheless, I think this is an improvement to the current situation. @ccordoba12 How to proceed?
|
This is the option I was planning to implement in a couple of weeks.
We can add this minor improvement to spyder-kernels 0.3. After that, I don't plan to add more enhancements to that branch.
I know wurlitzer is not part of Anaconda, but since it's already part of conda-forge, the Anaconda guys can add it without problems. |
I said minor in the sense that it doesn't require too much work and it's not too disruptive. I know it's very important to work with certain libraries. |
I guess this should be moved to the spyder-kernels repository? |
We can close this issue with a PR from spyder-kernels, so let's not move it because it has all our discussion about this topic. |
This will be fixed once we release |
Is it possible to turn off the C printing to the IPython console? I'd rather just see the C extension stuff in my terminal, which has the jupyter notebook opened. |
Sorry, now you can't opt-out of this behavior. |
It can't be toggled at runtime (except with some private API calls), but you can disable it globally: # ipython_config.py
c.IPKernelApp.capture_fd_output = False |
It works great! Thanks. |
Description of your problem
The output of C extensions that print to stdout is not shown in the ipython console. For Spyder 2 the output was shown in the kernel window.
A minimal example:
When executed from the command line a message is shown, in the Spyder 3 ipython console no output is shown at all.
Note: oapackage can by installed from pypi: https://pypi.python.org/pypi/OApackage. The output desired is generated by C++ code wrapped using SWIG.
Note: the same problem is there when the code is executed in an ipython notebook.
The text was updated successfully, but these errors were encountered: