JuliaIO / JLD.jl

Saving and loading julia variables while preserving native types
MIT License
277 stars 55 forks source link

Error reading boolean value and dictionnary with boolean value #251

Open ghost opened 5 years ago

ghost commented 5 years ago

Getting the following error when reading dictionnary with a boolean value

julia> file = jldopen("test.jld","w"); write(file,"d",Dict(:b => true)); close(file)

julia> file = jldopen("test.jld","r"); read(file,"d"); close(file)
ERROR: unrecognized HDF5 datatype class 4
Stacktrace:
 [1] error(::String, ::Int32) at .\error.jl:42
 [2] jldatatype(::JLD.JldFile, ::HDF5.HDF5Datatype) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\jld_types.jl:738
 [3] read_array(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Int32, ::Int32, ::Tuple{Int64}) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:411
 [4] read_array(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Int32, ::Int32) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:408
 [5] read(::JLD.JldDataset) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:372
 [6] read_ref(::JLD.JldFile, ::HDF5.HDF5ReferenceObj) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:502
 [7] jlconvert(::Type{JLD.AssociativeWrapper{Symbol,Bool,Dict{Symbol,Bool}}}, ::JLD.JldFile, ::Ptr{UInt8}) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\jld_types.jl:434
 [8] read_scalar(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Type) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:398
 [9] read(::JLD.JldDataset) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:370
 [10] read(::JLD.JldFile, ::String) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:346
 [11] top-level scope at none:0

And this, when reading a boolean value only

julia> file = jldopen("test.jld","w");write(file,"d",true);close(file)

julia> file = jldopen("test.jld","r");read(file,"d");close(file)
ERROR: unrecognized HDF5 datatype class 4
Stacktrace:
 [1] error(::String, ::Int32) at .\error.jl:42
 [2] jldatatype(::JLD.JldFile, ::HDF5.HDF5Datatype) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\jld_types.jl:738
 [3] read(::JLD.JldDataset) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:370
 [4] read(::JLD.JldFile, ::String) at C:\Users\homedir\.julia\packages\JLD\1BoSz\src\JLD.jl:346
 [5] top-level scope at none:0