JLD.jl
JLD.jl copied to clipboard
@save macro issues UndefVarError when packages have the same name functions
@save macro in JLD.jl is highly useful and convenient. However, I encountered the following problem. I am using both Plots.jl and LightGraphs.jl packages along with JLD.jl (v0.8.3) under Julia v0.6.1. When I computed things and tried to dump all the variables and arrays I generated using @save macro, I got the following error:
UndefVarError: center not defined
I myself do not have any variables/functions named center in my julia session, but I realized the following warning message earlier in the session:
WARNING: both LightGraphs and Plots export "center"; uses of it in module Main must be qualified
WARNING: both LightGraphs and Plots export "density"; uses of it in module Main must be qualified
Hence just in case, I tried to evaluate center = 0 in my julia session, and ran @save macro. Then I got:
UndefVarError: density not defined
Finally, I could run @save macro after I set density = 0 in my julia session.
Why does @save macro have something to do with those functions defined in other packages? Of course, I can use the usual save function of JLD.jl, but that requires more input arguments and especially inconvenient if I generated many variables and arrays in my session.
Thanks for your help!
BVPs