PythonCall.jl icon indicating copy to clipboard operation
PythonCall.jl copied to clipboard

IPython redirect stdout

Open cjdoris opened this issue 4 years ago • 2 comments

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.

cjdoris avatar Dec 10 '21 09:12 cjdoris

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?

stevengj avatar Apr 13 '22 16:04 stevengj

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

cjdoris avatar Apr 21 '22 11:04 cjdoris