Trying to print to a file from python using Pluto PyCall

Hi all

I am using Pluto and PyCall to run a whole python script which prints a stream of data to a file, using an asynch loop which I just check using tail. If I run it in REPL it works like a champ but in Pluto there is no output to the file. What am I missing please?

here is the print statement.

def output_redirection(conid)

    print( conid, file=open("/tmp/server.log","a"))

and here is the tail statement.

tail -f /tmp/server.log

this works wonderfully in REPL but NOT in Pluto. I run the cell below and there is no error and no output.


Try with_terminal from PlutoUI

Hi @lungben

a happy and safe new year to you and your.s That’s one of the first things I tried. No luck.
thank you for the suggestion though.

with_terminal() do

I think the issue is that has an active asynch loop inside it and Pluto might not like that.