Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to supress output to stdout? #1621

Open
nomadbl opened this issue Jul 3, 2023 · 8 comments
Open

How to supress output to stdout? #1621

nomadbl opened this issue Jul 3, 2023 · 8 comments

Comments

@nomadbl
Copy link

nomadbl commented Jul 3, 2023

In JuliaLogging/TensorBoardLogger.jl#127
I'm constantly getting

Compose.Image{Compose.PNGBackend}(IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=false, append=true, size=30688, maxsize=Inf, ptr=1, mark=-1), Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), CairoContext(Ptr{Nothing} @0x0000000000000000, Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Ptr{Nothing} @0x0000000006376250), 534.5059133378628, 377.9527559055118, RGBA{Float64}(0.0,0.0,0.0,0.0), RGBA{Float64}(0.0,0.0,0.0,1.0), Float64[], Compose.LineCapButt(), Compose.LineJoinMiter(), true, 0.3mm, 3.880555555555555mm, "Helvetica Neue,Helvetica,Arial,sans", nothing, false, Compose.ImagePropertyState[], Compose.ImagePropertyFrame[], Dict{Type, Union{Nothing, Compose.Property}}(), true, false, nothing, true, true, 3.7795275590551185, nothing, nothing)

On the cmd on each show(...)

The source is at https://github.com/JuliaLogging/TensorBoardLogger.jl/blob/d5842d17802e3b8b42d295ccd31c4f14ed4b0d32/src/Optional/Gadfly.jl
Is there a way to avoid this?

@bjarthur
Copy link
Member

bjarthur commented Jul 3, 2023

in julia in general to suppress output put a semicolon at the end of the line. just like matlab.

@nomadbl
Copy link
Author

nomadbl commented Jul 3, 2023

Thanks for the quick response.
I did actually try it and it didn't work (line 14 in the link), so it's probably something with render?

@bjarthur
Copy link
Member

bjarthur commented Jul 3, 2023

try on line 15.

your syntax is unusual for lines 10-15. if you're trying to define a function, then it should be:

function preproces...
...
end

not sure what you're trying to do with a begin block.

@nomadbl
Copy link
Author

nomadbl commented Jul 3, 2023

Thanks for that additional catch.
I've tried the semicolon in all these places just now, still no dice...
Is there some way you would approach how to track down the print that's going on?
It seems to come from Compose since we're seeing Compose.Image here, no?

@nomadbl
Copy link
Author

nomadbl commented Jul 3, 2023

I can reproduce the print on the REPL with:

using Gadfly, Cairo, Fontconfig
pb = PipeBuffer();
p = plot(x=rand(100), Geom.point);
show(pb, MIME("image/png"), render(p));

@nomadbl
Copy link
Author

nomadbl commented Jul 6, 2023

I did a bit more investigating.
I think the output we are seeing is coming from this line in the Compose code or somewhere around that..
Still trying to figure out the code, so any help is welcome 😃

@bjarthur
Copy link
Member

bjarthur commented Jul 6, 2023

might try reducing your MWE to sth that just uses Compose and not Gadfly. if you can do that, then cross-post an issue to Compose.

@nomadbl
Copy link
Author

nomadbl commented Jul 6, 2023

I'm working on putting together that MWE, just stopping to mention this line
img.emit_on_finish && typeof(img.out) == IOBuffer && display(img)
In some cases, which is our case I suspect, img.emit_on_finish is true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants