# Problem loading old JLD files with "Bool" properties

**URL:** <https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926>\
**Category:** General Usage\
**Created:** [February 18, 2019, 8:15am UTC](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926 "2019-02-18T08:15:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![acunningham](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@acunningham](https://discourse.julialang.org/u/acunningham)\
**Post date:** [February 18, 2019, 8:15am UTC](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926/1 "2019-02-18T08:15:32Z")

</div>

Hi,

I’m trying to load some old JLD files that were created in Julia 0.6 for use in Julia 1.1, however there seems to be issue with loading the `Bool` .

I have a small sample to demonstrate

**Created in 0.6**

```julia
using JLD

mutable struct foo
    is_true::Bool
    name::String
end

a= foo(true, "Test true")

file_path = "c:\\temp\\foo.jld"
file_dir, file_name = splitdir(file_path)
file_prefix, file_ext = splitext(file_name)

JLD.save(file_path, file_prefix, a, compress=false)

```

**Load in Julia 1.1**

```julia
obj = JLD.load(file_path, file_prefix)

stored type Core.Bool does not match currently loaded type

Stacktrace:
 [1] macro expansion at .\logging.jl:320 [inlined]
 [2] jldatatype(::JLD.JldFile, ::HDF5.HDF5Datatype) at C:\Program Files\ReSolver.DistributedJulia\depot\packages\JLD\1BoSz\src\jld_types.jl:703
 [3] macro expansion at .\logging.jl:316 [inlined]
 [4] jldatatype(::JLD.JldFile, ::HDF5.HDF5Datatype) at C:\Program Files\ReSolver.DistributedJulia\depot\packages\JLD\1BoSz\src\jld_types.jl:703
 [5] read(::JLD.JldDataset) at C:\Program Files\ReSolver.DistributedJulia\depot\packages\JLD\1BoSz\src\JLD.jl:370
 [6] read(::JLD.JldFile, ::String) at C:\Program Files\ReSolver.DistributedJulia\depot\packages\JLD\1BoSz\src\JLD.jl:346
 [7] #42 at C:\Program Files\ReSolver.DistributedJulia\depot\packages\JLD\1BoSz\src\JLD.jl:1240 [inlined]
 [8] #jldopen#14(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(JLD, Symbol("##42#43")){String}, ::String, ::Vararg{String,N} where N) at C:\Program Files\ReSolver.DistributedJulia\depot\packages\JLD\1BoSz\src\JLD.jl:246
 [9] jldopen at C:\Program Files\ReSolver.DistributedJulia\depot\packages\JLD\1BoSz\src\JLD.jl:244 [inlined]
 [10] load at C:\Program Files\ReSolver.DistributedJulia\depot\packages\JLD\1BoSz\src\JLD.jl:1239 [inlined]
 [11] #load#13(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String, ::String) at C:\Program Files\ReSolver.DistributedJulia\depot\packages\FileIO\YJO7Z\src\loadsave.jl:118
 [12] load(::String, ::String) at C:\Program Files\ReSolver.DistributedJulia\depot\packages\FileIO\YJO7Z\src\loadsave.jl:118
 [13] top-level scope at In[18]:1

```

Thanks,  
Adrian.

---

<div class="post-metadata">

**Author:** ![Simon\_Bolland](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simon_bolland/32/8920_2.png) [@Simon\_Bolland](https://discourse.julialang.org/u/Simon_Bolland)\
**Post date:** [February 18, 2019, 11:28am UTC](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926/2 "2019-02-18T11:28:42Z")

</div>

Your example is incomplete.

Variable **a** doesn’t get assigned a value (I would assume it’s a **foo** struct).

There must be more in the Julia 1.1 code (at least setting **file\_path** and **file\_prefix** , presumably as in v0,7, and probably defining the **foo** struct).

However, filling in my assumptions works for me (using JLD 0.9.1 on both Julia versions and with the file location amended to a valid location for me).

Julia 0.7

```nohighlight
       mutable struct foo
           is_true::Bool
           name::String
       end
       file_path=raw"c:\Users\simon\Temp\test.jld"
       file_dir, file_name = splitdir(file_path)
       file_prefix, file_ext = splitext(file_name)
       a=foo(true,"test true")
       JLD.save(file_path, file_prefix, a, compress=false)

```

Julia 1.1

```nohighlight
       mutable struct foo
           is_true::Bool
           name::String
       end
       file_path=raw"c:\Users\simon\Temp\test.jld"
       file_dir, file_name = splitdir(file_path)
       file_prefix, file_ext = splitext(file_name)
       obj = JLD.load(file_path, file_prefix)

```

gives me

`foo(true, "test true")`

I’ve checked it also works for false

---

<div class="post-metadata">

**Author:** ![acunningham](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@acunningham](https://discourse.julialang.org/u/acunningham)\
**Post date:** [February 18, 2019, 11:45am UTC](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926/3 "2019-02-18T11:45:59Z")

</div>

Simon,

Thanks for the response, and my apologies I was indeed missing a single line of the example which was assigning a value to foo - I’ve updated the example

I’ve done some more investigating and I believe that the original JLD file may have been written out using Julia 0.6 rather than 0.7 as I’ve stated.

Thanks.

---

<div class="post-metadata">

**Author:** ![monty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/monty/32/44234_2.png) [@monty](https://discourse.julialang.org/u/monty)\
**Post date:** [March 20, 2019, 1:12am UTC](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926/4 "2019-03-20T01:12:22Z")

</div>

Have you resolved the JLD / Core.Bool problem?

---

<div class="post-metadata">

**Author:** ![acunningham](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@acunningham](https://discourse.julialang.org/u/acunningham)\
**Post date:** [March 21, 2019, 12:06pm UTC](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926/5 "2019-03-21T12:06:12Z")

</div>

Somewhat, I believe there was a bug fix to the JLD library seems to have worked, so I downloaded these code files directly and overwrote the existing JLD library source files.

However I still seem to have issues with some of my old JLD files. So trying to figure which versions of julia / JLD I need to read the old JLD’s with and write them back out so they work fully with 1.1.

> <https://github.com/JuliaIO/JLD.jl/commit/5df11199a2d1c4be76f029d6e3177d6d71791856#diff-e740f7f7b394b9e98a0b1e800a84b417>

---

<div class="post-metadata">

**Author:** ![monty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/monty/32/44234_2.png) [@monty](https://discourse.julialang.org/u/monty)\
**Post date:** [March 22, 2019, 2:36pm UTC](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926/6 "2019-03-22T14:36:55Z")

</div>

`JLD.translate("Core.Bool", "crazybool")`

resolves the problem. it forces JLD to reconstruct the type from the file.
