JuliaPy / PythonCall.jl

Python and Julia in harmony.
https://juliapy.github.io/PythonCall.jl/stable/
MIT License
777 stars 63 forks source link

IPython redirect stdout #84

Open cjdoris opened 2 years ago

cjdoris commented 2 years ago

We used to set Base.stdout to PyIO(sys.stdout) but this causes bugs so is removed.

Instead copy the IJulia approach: use pipe = redirect_stdout() and have an async task watch the pipe for output and write it to sys.stdout.

stevengj commented 2 years ago

What PyCall does is to set sys.stdout to Base.stdout and it seems to work fine.

I recently also updated PyCall to install a post-execute hook to flush Python stdio after each cell is executed in IJulia.

But maybe you are talking about JuliaCall from IPython here, not PythonCall from IJulia?

cjdoris commented 2 years ago

Yeah exactly, this ticket is about the other side (using JuliaCall from IPython).