# Trying to print to a file from python using Pluto PyCall

**URL:** <https://discourse.julialang.org/t/trying-to-print-to-a-file-from-python-using-pluto-pycall/74165>\
**Category:** New to Julia\
**Created:** [January 6, 2022, 10:36pm UTC](https://discourse.julialang.org/t/trying-to-print-to-a-file-from-python-using-pluto-pycall/74165 "2022-01-06T22:36:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon69491625](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Post date:** [January 6, 2022, 10:36pm UTC](https://discourse.julialang.org/t/trying-to-print-to-a-file-from-python-using-pluto-pycall/74165/1 "2022-01-06T22:36:26Z")

</div>

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.

```julia
def output_redirection(conid)

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

```

and here is the tail statement.

```julia
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.

```julia
@pyinclude("test_file.py")

```

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [January 7, 2022, 6:51am UTC](https://discourse.julialang.org/t/trying-to-print-to-a-file-from-python-using-pluto-pycall/74165/2 "2022-01-07T06:51:15Z")

</div>

Try with\_terminal from PlutoUI

---

<div class="post-metadata">

**Author:** ![anon69491625](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Post date:** [January 7, 2022, 8:11am UTC](https://discourse.julialang.org/t/trying-to-print-to-a-file-from-python-using-pluto-pycall/74165/3 "2022-01-07T08:11:46Z")

</div>

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.

```julia
with_terminal() do
    @pyinclude("test_file.py")
end

```

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