This came up in the attempt to get Interact.jl working on v0.6-dev. It currently fails when trying to display some HTML. A MRE is:
if displayable("text/html")
display("text/html", """foo""")
end
In the REPL in Julia v0.5, displayable("text/html")
return false
, which makes sense. In Julia v0.6-dev, however, it returns true
in the REPL, which leads to errors when trying to actually display:
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.0-dev.2834 (2017-02-16 21:11 UTC)
_/ |\__'_|_|_|\__'_| | Commit 3222749* (0 days old master)
|__/ | x86_64-apple-darwin15.6.0
julia> displayable("text/html")
true
julia> if displayable("text/html")
display("text/html", """foo""")
end
ERROR: MethodError: no method matching show(::Base.TTY, ::MIME{Symbol("text/html")}, ::String)
Closest candidates are:
show(::IO, ::MIME{mime}) where mime at multimedia.jl:21
show(::IO, ::ANY) at show.jl:125
show(::IO, ::AbstractString, ::Any) at multimedia.jl:39
...
Stacktrace:
[1] display(::TextDisplay, ::MIME{Symbol("text/html")}, ::String) at ./multimedia.jl:158
[2] display(::MIME{Symbol("text/html")}, ::String) at ./multimedia.jl:208
[3] display(::String, ::String) at ./multimedia.jl:126
Specifically, it’s the first display (the Base.TTY) that thinks it can display “text/html”:
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.0-dev.2834 (2017-02-16 21:11 UTC)
_/ |\__'_|_|_|\__'_| | Commit 3222749* (0 days old master)
|__/ | x86_64-apple-darwin15.6.0
julia> displayable("text/html")
true
julia> displayable(Base.Multimedia.displays[1], "text/html")
true
julia> displayable(Base.Multimedia.displays[2], "text/html")
false
julia> Base.Multimedia.displays[1]
TextDisplay(Base.TTY(RawFD(14) open, 0 bytes waiting))
Is this a bug? Or is the package doing something wrong?