How to make CFFI stdout print in jupyter?

163 views
Skip to first unread message

Dmitry Ulyanov

unread,
Oct 17, 2016, 4:46:58 AM10/17/16
to Project Jupyter

Hello, I wrapped a C function with CFFI, works smoothly if ran as python script. But when I copy paste the code to jupyter notebook and try to run there I do not see any prints, produced by C function. Is there a way to get the prints working for jupyter? Thank you!


P.S CFFI developer could not help told me to ask here... 


MinRK

unread,
Oct 17, 2016, 4:53:44 AM10/17/16
to Project Jupyter

You can use a tool called wurlitzer to capture C-level piped output:

from wurlitzer import sys_pipes
with sys_pipes():
    call_c_function()

-Min


On Mon, Oct 17, 2016 at 10:46 AM, Dmitry Ulyanov <dmitry.ul...@gmail.com> wrote:

Hello, I wrapped a C function with CFFI, works smoothly if ran as python script. But when I copy paste the code to jupyter notebook and try to run there I do not see any prints, produced by C function. Is there a way to get the prints working for jupyter? Thank you!


P.S CFFI developer could not help told me to ask here... 


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/0dd68b38-3aa3-4883-aada-316eb9b261c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dmitry Ulyanov

unread,
Oct 17, 2016, 12:29:58 PM10/17/16
to Project Jupyter
Thank you!


On Monday, October 17, 2016 at 11:53:44 AM UTC+3, Min RK wrote:

You can use a tool called wurlitzer to capture C-level piped output:

from wurlitzer import sys_pipes
with sys_pipes():
    call_c_function()

-Min

On Mon, Oct 17, 2016 at 10:46 AM, Dmitry Ulyanov <dmitry.ul...@gmail.com> wrote:

Hello, I wrapped a C function with CFFI, works smoothly if ran as python script. But when I copy paste the code to jupyter notebook and try to run there I do not see any prints, produced by C function. Is there a way to get the prints working for jupyter? Thank you!


P.S CFFI developer could not help told me to ask here... 


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages