JuliaIO / BSON.jl

Other
158 stars 39 forks source link

bson(path, plot) once => Plots broken thereafter #75

Open kolia opened 3 years ago

kolia commented 3 years ago

This one's a little spooky, and took me a loooong time to debug, because the Stacktraces are completely misleading.

julia> using Plots, BSON

julia> plot(rand(10));   # now it works

julia> bson("/tmp/test.bson", p = plot(rand(10)))

julia> plot(rand(10));    # now it doesn't
ERROR: MethodError: no method matching plot_color(::Dict{Symbol,Any})
Closest candidates are:
  plot_color(::Any, ::Nothing) at /home/ubuntu/.julia/packages/PlotUtils/NS6Tf/src/colors.jl:20
  plot_color(::Any, ::Number) at /home/ubuntu/.julia/packages/PlotUtils/NS6Tf/src/colors.jl:23
  plot_color(::Symbol) at /home/ubuntu/.julia/packages/PlotUtils/NS6Tf/src/colors.jl:7
  ...
Stacktrace:
 [1] _update_plot_args(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}) at /home/ubuntu/.julia/packages/Plots/ey5o3/src/args.jl:1419
 [2] _plot_setup(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}) at /home/ubuntu/.julia/packages/Plots/ey5o3/src/pipeline.jl:183
 [3] plot_setup! at /home/ubuntu/.julia/packages/Plots/ey5o3/src/pipeline.jl:156 [inlined]
 [4] recipe_pipeline!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Float64,1}}) at /home/ubuntu/.julia/packages/RecipesPipeline/qM4Ea/src/RecipesPipeline.jl:86
 [5] _plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Float64,1}}) at /home/ubuntu/.julia/packages/Plots/ey5o3/src/plot.jl:167
 [6] plot(::Array{Float64,1}; kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/ubuntu/.julia/packages/Plots/ey5o3/src/plot.jl:57
 [7] plot(::Array{Float64,1}) at /home/ubuntu/.julia/packages/Plots/ey5o3/src/plot.jl:51
 [8] top-level scope at REPL[11]:1

All attempts to plot thereafter fail similarly.

That's with BSON v0.2.6, Plots v1.6.1, but I've had the same happen with Plots 1.5.3+.

Any idea what BSON.jl is doing that might cause this? Type piracy?