-
Notifications
You must be signed in to change notification settings - Fork 92
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
Reconstructing types defined in one module inside another #107
Comments
I got a similar issue. this blocked my work! |
This screwed me over to.
|
Yes, I have the same problem! Interestingly, the current version of JLD v0.9.0 works without any problem of saving and loading such composite data types under Julia v1.0.1 although the saved file size is larger than that of JLD2. |
This might be related to #126 You can call |
This happens for me even for types defined in packages that are on the load path/project:
|
Which makes it basically impossible to use JLD2 in Weave.jl (at least without turning sandboxing off which |
I'm seeing the same issue in trying to upgrade some code from Julia 0.6. What seems to work is to have all the necessary packages loaded in the This isn't a viable workaround in the long run, but hopefully it sheds some light on what's going on. |
It seems JLD2 looks for modules in A related workaround I found (can't remember where right now) is to add a line |
So I tried seeing what happens if I tried using JLD instead of JLD2. The code above still performes a reconstruction warning (not the case in Julia0.6). However, with JLD there's the |
Probably it was here :) Adding |
The following worked in julia v0.6 but no longer works in v0.7:
I have a type defined in ModA.jl (in
LOAD_PATH
):I save data with my type in a JLD2 file:
In some code I run separately, I try to load the data inside a module and I get a warning:
Then if I try to interact with
ModB.t
(e.g. call functions on it defined only on typeMyType
), I get an error (because the type is wrong). This is similar to #82; may be related?The problem is alleviated by doing an
import ModA
at the top level before I try to loadModB
, so I suspect the reason this worked on v0.6 and doesn't on v0.7 is due to (JuliaLang/julia#17997). I'm wondering if this just means I need to change my workflow and always load modules with user-defined types at the top level before trying to load files containing those types, or if this is something that can be addressed in JLD2? For example, would there be a way to make JLD2 "see" thatModA
has beenimport
ed insideModB
and recognizeModA.MyType
without the need to explicitlyimport ModA
at the top level?The text was updated successfully, but these errors were encountered: