Closed BioTurboNick closed 1 year ago
That's weird. I'm just using a simple DataFrame to print the AnovaObject:
function Base.show(io::IO, x::AnovaObject)
print(DataFrame(
Source = x.Source,
DF = x.DF,
SS = x.SS,
MSS = x.MSS,
F = x.F,
p = x.p
))
end
The only thing I can think of is that DataFrame itself creates the output. I currently don't have a Julia output installed but will look into it when I have more time. Thanks for the issue!
It's possible it's a more general issue with the REPL or Juno. For instance, I've noticed that when I return a plot from a function, it may render twice. I might poke around more.
Have you been able to solve your issue?
Yes, it appears that the issue is specific to the Juno REPL. It does not occur when Julia REPL is run in CMD.exe.
I'm closing this and I'll report it for Juno.
Hm, the problem isn't really with Juno here but with your show
method -- it's expected that you actually print something to io
instead of stdout
, i.e.
function Base.show(io::IO, x::AnovaObject)
print(io, DataFrame(
Source = x.Source,
DF = x.DF,
SS = x.SS,
MSS = x.MSS,
F = x.F,
p = x.p
))
end
I'm pretty confident that making this change will fix the weird behaviour in Juno/JuliaPro.
Ah. Why would the behavior differ between the two REPLs? (Actually, it's the same REPL though, just run inside Juno.)
Not sure, tbh. I can't repro this when evaling in the REPL only. Can you try
struct Foo end
function Base.show(io::IO, x::Foo)
print("hii")
sleep(0.5)
print("ho")
end
Foo()
in the REPL and in an editor for me?
In Juno:
julia> Foo()
hiihiiho
julia> ho
Where "ho" is just displayed at the prompt but not really there.
Edit: Second time I ran it, the last "ho" appeared before the prompt. Third time the last "ho" didn't appear at all.
show(stdout, Foo())
produces the correct output.
If I add a method without io::IO
argument, show(Foo())
works, but Foo()
alone still has the issue.
Right, I can repro now. This only happens in JuliaPro and not in a standalone Juno install, probably be because the former is built with older releases.
struct Foo end
function Base.show(io::IO, x::Foo)
print(io, "hii")
sleep(0.5)
print(io, "ho")
end
Foo()
works correctly for me in Juno, JuliaPro, and a standalone REPL. Can you confirm?
Confirmed. Thanks @pfitzseb . I'll grab standalone Juno.
The show
method should still be fixed in this package though, @marcpabst.
Thanks, @pfitzseb for exposing the problem! I'll make the change within the next few days!
Will be fixed as part of #10.
The output of anova() at the REPL prints its output normally first, then repeats it after the
Julia>
prompt interrupting the first line. Typing at the prompt moves the prompt to the last line, overwriting it.This is in JuliaPro 1.0.1.1 with Julia 1.0.2