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

"stored type does not match" error with "read" function but ok with "load" function #68

Open
YongHee-Kim opened this issue May 26, 2016 · 0 comments

Comments

@YongHee-Kim
Copy link

this might be related to issues/158

I'm currently working on simulation program and using JLD for logging.
but while analysing log data, I found strange behavior with JLD. That same function "load" and "read" does not work as same function.

here is my example code

using JLD

type Item
    uid::UInt32
    id::Int32
    count::Int32
    let counter = UInt32(0)
        Item(id, count) =  new(counter += 1, id, count)
    end
end

# create dummy Data
items = Item[]
for i in 1:10, j in 1:5
    push!(items, Item(i, j))
end

jldopen("test.jld", "w") do file
    write(file, "log1", Dict(:date => DateTime(1,1,1), :item=>items))
end

for i in 1:10
    items[i].count += rand(1:100)
end

jldopen("test.jld", "r+") do file
    write(file, "log2", Dict(:date => DateTime(1,1,2), :item=>items))
end

This works fine

println(load("test.jld", "log1"))`
println(load("test.jld", "log2"))

But this does not work!
pops up "stored type Base.Dates... does not match currently loaded type" error which is not even my custom type.

jldopen("test.jld", "r") do file
    println(read(file, "log1"))
    println(read(file, "log2"))
end
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