Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot save Dict{Symbol} #266

Open
jonas-schulze opened this issue Nov 4, 2019 · 0 comments
Open

Cannot save Dict{Symbol} #266

jonas-schulze opened this issue Nov 4, 2019 · 0 comments

Comments

@jonas-schulze
Copy link

When using DrWatson.jl's collect_results! with JLD as the desired output format, things break. Internally, it tries to store a Dict{Symbol,DataFrame} (see here; wsave is just a copy of FileIO's save).

ERROR: LoadError: Keys must be strings (the names of variables), got df
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] (::getfield(JLD, Symbol("##32#33")){Dict{Symbol,DataFrame}})(::JLD.JldFile) at /Users/jonas/.julia/packages/JLD/1BoSz/src/JLD.jl:1210
 [3] #jldopen#14(::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:compatible, :compress),Tuple{Bool,Bool}}}, ::Function, ::getfield(JLD, Symbol("##32#33")){Dict{Symbol,DataFrame}}, ::String, ::Vararg{String,N} where N) at /Users/jonas/.julia/packages/JLD/1BoSz/src/JLD.jl:246
 [4] #jldopen at ./none:0 [inlined]
 [5] #save#31 at /Users/jonas/.julia/packages/JLD/1BoSz/src/JLD.jl:1206 [inlined]
 [6] save at /Users/jonas/.julia/packages/JLD/1BoSz/src/JLD.jl:1206 [inlined]
 [7] #save#15(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String, ::Dict{Symbol,DataFrame}) at /Users/jonas/.julia/packages/FileIO/JAtC1/src/loadsave.jl:118
 [8] save(::String, ::Dict{Symbol,DataFrame}) at /Users/jonas/.julia/packages/FileIO/JAtC1/src/loadsave.jl:118
 [9] #collect_results!#34(::Array{String,1}, ::Bool, ::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String, ::String) at /Users/jonas/.julia/packages/DrWatson/bCPTC/src/result_collection.jl:108
 [10] collect_results!(::String, ::String) at /Users/jonas/.julia/packages/DrWatson/bCPTC/src/result_collection.jl:72
...

MWE:

using DrWatson, JLD, DataFrames

data = Dict("foo" => :bar)
mkdir("tmp")
save(joinpath("tmp", "a.jld"), data)
save(joinpath("tmp", "b.jld"), data)

collect_results!("results.jld", "tmp")

I don't know the internals/conventions for FileIO's save, so maybe this shouldn't be supported at all. However, using BSON as the output format, saving a Dict{Symbol} works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant