capture stdout/stderr output from cython/c modules
2,169 views
Skip to first unread message
PeterC
unread,
Mar 7, 2016, 2:09:41 PM3/7/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Project Jupyter
print() statements in python *.py and cython *.pyx modules appear in the Jupyter nb but printf() statements from extern c functions in a cython module appear in the console that launched the Jupyter session.
I have some cython modules with external c functions which printf() and fprintf() info to stdout and stderr. Is it possible to get them to print to the Jupyter notebook like regular python and cython print() statements and if so then how?
Many thanks, Peter
Matthias Bussonnier
unread,
Mar 7, 2016, 2:38:18 PM3/7/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jup...@googlegroups.com
Hello Peter,
Unfortunately the python redirection is done by monkey patching
sys.stdout/err. It is not easy (maybe likely not possible) to redirect
things that get called from c or cython.
as they access filedescriptors directly.