JuliaIO / JLD2.jl

HDF5-compatible file format in pure Julia
Other
537 stars 84 forks source link

UndefVarError: #68#new_logstate not defined #471

Closed michaelschwob closed 1 year ago

michaelschwob commented 1 year ago

I just started receiving the following error when running @save "save.jld2"

ERROR: UndefVarError: #68#new_logstate not defined
Stacktrace:
 [1] top-level scope
   @ ~/.julia/packages/JLD2/ryhNR/src/loadsave.jl:86

I have no idea how to resolve this error, and it seems to have come about out of nowhere. This code was just working before. I didn't update any packages or remove the JLD2 package. I'm a bit confused on where this error is coming from.

JonasIsensee commented 1 year ago

Hi @michaelschwob,

I recommend that you avoid using @save "file.jld2" - in particular without supplying the variable names. I understand that it is convenient, however from the library side it's not possible to do this right. The macro has to somehow search through all names in Main and decide which to store and which to ignore. @save has been made undocumented years ago.

What you are seeing is that julia or some library exported the name #68#new_logstate into Main. I don't know what it is but it seems JLD2 can't deal with it properly but since it's a gensymed object it probably also shouldn't need to.

Edit: If you are encountering problems with objects that you do want to save, that is of course a very different story.

michaelschwob commented 1 year ago

Thank you for your response and help!

michaelschwob commented 1 year ago

I finally found the problem. The Suppressor package used in conjunction with JLD2 was giving this issue!