Suppressing automatic display(::Makie.Scene) in the REPL

A common occurrence when I’m working on Makie stuff at the REPL:

julia> foo = some_function_that_returns_a_scene()
Error showing value of type Makie.Scene:
ERROR: AssertionError: internal error. Scene already displayed by screen but not as root scene

This happens to be with GLMakie and in the VS Code REPL but I think something similar can happen with other backends and just at a plain terminal.

Is there some way to turn off this behavior? What I really want here is for the REPL to just print out a description of the Scene, i.e. something like:

julia> println(repr(foo))
Scene (1000px, 1000px):
  1 Plot:
    └ MakieCore.Combined{Makie.tooltip, Tuple{GeometryBasics.Point{2, Float32}}}
  0 Child Scenes

Do you have a complete example that triggers this error for you? Just to understand what you’re doing, irrespective of the error message and what could be done about that.

To remove the error, at least, have you tried ; at the end of the statement, like

julia> foo = some_function_that_returns_a_scene();


Sure, just something as simple as e.g.

using Makie
using GLMakie
f = Figure() # opens a window, OK
s = Scene(f.scene) # throws the AssertionError

Yes, a trailing semicolon of course suppresses this but it’s easy to forget and in general I never want to implicitly display, but I often want to see the repr while doing exploratory work.