PlotlyJS.jl
PlotlyJS.jl copied to clipboard
savefig produce error and failed to save figure when offline
versioninfo(): Julia Version 1.7.3 Commit 742b9abb4d (2022-05-06 12:58 UTC) Platform Info: OS: Linux (x86_64-pc-linux-gnu) CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
The following code:
using PlotlyJS
data = bar(;x=["giraffes", "orangutans", "monkeys"],
y=[20, 14, 23])
testfig=plot(data)
PlotlyJS.savefig(testfig,"fig1.jpeg")
Got this error when not connected to the internet
Transform failed with error code 1: Failed to serialize document: Uncaught
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] savefig(p::Plot{Vector{GenericTrace{Dict{Symbol, Any}}}, Layout{Dict{Symbol, Any}}, Vector{PlotlyFrame}}; width::Nothing, height::Nothing, scale::Nothing, format::String)
@ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:110
[3] savefig(p::PlotlyJS.SyncPlot; kwargs::Base.Pairs{Symbol, Union{Nothing, String}, NTuple{4, Symbol}, NamedTuple{(:width, :height, :scale, :format), Tuple{Nothing, Nothing, Nothing, String}}})
@ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:71
[4] savefig(io::IOStream, p::PlotlyJS.SyncPlot; width::Nothing, height::Nothing, scale::Nothing, format::String)
@ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:154
[5] (::PlotlyJS.var"#36#37"{Nothing, Nothing, Nothing, PlotlyJS.SyncPlot})(f::IOStream)
@ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:187
[6] open(::PlotlyJS.var"#36#37"{Nothing, Nothing, Nothing, PlotlyJS.SyncPlot}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:330
[7] open
@ ./io.jl:328 [inlined]
[8] savefig(p::PlotlyJS.SyncPlot, fn::String; format::Nothing, width::Nothing, height::Nothing, scale::Nothing)
@ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:186
[9] savefig(p::PlotlyJS.SyncPlot, fn::String)
@ PlotlyJS ~/.julia/packages/PlotlyJS/4jzLr/src/kaleido.jl:181
[10] top-level scope
and fig1.jpeg has 0 bytes.
When I connect to the internet fig1.jpeg works but I also get error mesages:
UndefVarError: setexcludinghandlers! not defined
Stacktrace:
[1] set_nosync(ob::Observables.Observable{Dict{Any, Any}}, val::Dict{String, Any})
@ WebIO ~/.julia/packages/WebIO/4JqEH/src/scope.jl:352
[2] dispatch(ctx::WebIO.Scope, key::String, data::Dict{String, Any})
@ WebIO ~/.julia/packages/WebIO/4JqEH/src/scope.jl:368
[3] dispatch_command(conn::Blink.AtomShell.WebIOBlinkComm, data::Dict{String, Any})
@ WebIO ~/.julia/packages/WebIO/4JqEH/src/messaging.jl:104
[4] dispatch(conn::Blink.AtomShell.WebIOBlinkComm, data::Dict{String, Any})
@ WebIO ~/.julia/packages/WebIO/4JqEH/src/messaging.jl:81
[5] (::Blink.AtomShell.var"#22#23"{Blink.AtomShell.WebIOBlinkComm})(msg::Dict{String, Any})
@ Blink.AtomShell ~/.julia/packages/Blink/mwJC9/src/AtomShell/webio.jl:24
[6] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[7] invokelatest
@ ./essentials.jl:714 [inlined]
[8] handle_message(o::Blink.Page, m::Dict{String, Any})
@ Blink ~/.julia/packages/Blink/mwJC9/src/rpc/callbacks.jl:7
[9] macro expansion
@ ~/.julia/packages/Lazy/9Xnd3/src/macros.jl:268 [inlined]
[10] ws_handler(req::Dict{Any, Any})
@ Blink ~/.julia/packages/Blink/mwJC9/src/content/server.jl:56
[11] splitquery(app::typeof(Blink.ws_handler), req::Dict{Any, Any})
@ Mux ~/.julia/packages/Mux/3h8RY/src/basics.jl:31
[12] #1
@ ~/.julia/packages/Mux/3h8RY/src/Mux.jl:10 [inlined]
[13] wcatch(app::Mux.var"#1#2"{typeof(Mux.splitquery), typeof(Blink.ws_handler)}, req::Dict{Any, Any})
@ Mux ~/.julia/packages/Mux/3h8RY/src/websockets_integration.jl:12
[14] #1
@ ~/.julia/packages/Mux/3h8RY/src/Mux.jl:10 [inlined]
[15] todict
@ ~/.julia/packages/Mux/3h8RY/src/basics.jl:25 [inlined]
[16] #3 (repeats 2 times)
@ ~/.julia/packages/Mux/3h8RY/src/Mux.jl:14 [inlined]
[17] (::Mux.var"#1#2"{Mux.var"#3#4"{Mux.var"#3#4"{typeof(Mux.todict), typeof(Mux.wcatch)}, typeof(Mux.splitquery)}, typeof(Blink.ws_handler)})(x::Tuple{HTTP.Messages.Request, WebSockets.WebSocket{Sockets.TCPSocket}})
@ Mux ~/.julia/packages/Mux/3h8RY/src/Mux.jl:10
[18] (::Mux.var"#9#10"{Mux.App})(req::HTTP.Messages.Request, client::WebSockets.WebSocket{Sockets.TCPSocket})
@ Mux ~/.julia/packages/Mux/3h8RY/src/server.jl:49
[19] upgrade(f::Mux.var"#9#10"{Mux.App}, stream::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
@ WebSockets ~/.julia/packages/WebSockets/QcswW/src/HTTP.jl:201
[20] (::WebSockets.var"#_servercoroutine#11"{WebSockets.ServerWS})(stream::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
@ WebSockets ~/.julia/packages/WebSockets/QcswW/src/HTTP.jl:370
[21] macro expansion
@ ~/.julia/packages/HTTP/aTjcj/src/Servers.jl:415 [inlined]
[22] (::HTTP.Servers.var"#13#14"{WebSockets.var"#_servercoroutine#11"{WebSockets.ServerWS}, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, HTTP.Servers.Server{Nothing, Sockets.TCPServer}, HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})()
@ HTTP.Servers ./task.jl:429
It would be very helpful if someone could help me find a way to save the figure as a local file without connecting to the internet. Thank you!
Regarding the UndefVarError
: you could pin WebIO
to v0.8.17 as described in https://github.com/JuliaGizmos/WebIO.jl/issues/493#issuecomment-1175841764
Regarding the
UndefVarError
: you could pinWebIO
to v0.8.17 as described in JuliaGizmos/WebIO.jl#493 (comment)
Thank you!! That fixed the UndefVarError!
Do you maybe have any thoughts on the 'Transform failed' error?
Do you maybe have any thoughts on the 'Transform failed' error?
Sorry, this is above my pay grade. Maybe @sglyon can answer that?
I'm currently on a shaky internet connection and I get this problem very very often when using savefig
:
Transform failed with error code 1: Failed to serialize document: Uncaught
.
It seems to me like a bug that it tries to connect to the internet just to save a file locally. Is it a problem in Kaleido or a config issue of how Kaleido is used?