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

BSON doesn't seem to work with Pluto.jl and DataFrames.jl #93

Open
BoZenKhaa opened this issue Apr 1, 2021 · 4 comments
Open

BSON doesn't seem to work with Pluto.jl and DataFrames.jl #93

BoZenKhaa opened this issue Apr 1, 2021 · 4 comments

Comments

@BoZenKhaa
Copy link

The following code

begin
	using BSON
	using DataFrames
	using DrWatson
	
	b = DataFrame(v = [1,2],l = ["a", "b"])
	DrWatson.save("./test.bson", Dict(:b=>b))
	
	BSON.load("./test.bson")
end

fails in Pluto notebook with

UndefVarError: DataFrames not defined

    (::BSON.var"#29#30")(::Module, ::String)@extensions.jl:20
    BottomRF@reduce.jl:81[inlined]
    _foldl_impl(::Base.BottomRF{BSON.var"#29#30"}, ::Module, ::Vector{Any})@reduce.jl:58
    foldl_impl@reduce.jl:48[inlined]
    mapfoldl_impl@reduce.jl:44[inlined]
    _mapreduce_dim@reducedim.jl:315[inlined]
    #mapreduce#[email protected]:310[inlined]
    #reduce#[email protected]:359[inlined]
    resolve(::Vector{Any})@extensions.jl:20
    (::BSON.var"#33#34")(::BSON.BSONDict)@extensions.jl:53
    _raise_recursive(::BSON.BSONDict, ::IdDict{Any, Any})@read.jl:79
    raise_recursive(::BSON.BSONDict, ::IdDict{Any, Any})@read.jl:89
    (::BSON.var"#43#44")(::BSON.BSONDict, ::IdDict{Any, Any})@extensions.jl:138
    raise_recursive(::BSON.BSONDict, ::IdDict{Any, Any})@read.jl:88
    (::BSON.var"#18#20"{IdDict{Any, Any}})(::BSON.BSONDict)@read.jl:82
    applychildren!(::BSON.var"#18#20"{IdDict{Any, Any}}, ::BSON.BSONDict)@BSON.jl:34
    _raise_recursive(::BSON.BSONDict, ::IdDict{Any, Any})@read.jl:82
    raise_recursive(::BSON.BSONDict, ::IdDict{Any, Any})@read.jl:89
    raise_recursive@read.jl:99[inlined]
    load(::String)@read.jl:104
    top-level scope@Local: 9

This code runs fine in REPL.
When using JLD2, there is no problem in loading saved files, which makes me think this may be a BSON issue and not Pluto or DataFrames issue.

@haozhangphd
Copy link

This seems to be a duplicate of #25. Please use BSON.load("./test.bson", @__MODULE__)

@BoZenKhaa
Copy link
Author

BoZenKhaa commented Apr 3, 2021

Thanks a lot for the tip! However, #25 seems to be closed?

@haozhangphd
Copy link

Yes it is closed by #91, but the default value of load(x, init=Main) can still cause confusions...

@BoZenKhaa
Copy link
Author

Ok, thank you for clarification. I think it could be worthwhile to keep this issue open since the error message seems very cryptic, at least to me. Or should I close this?

dahong67 added a commit to dahong67/CacheVariables.jl that referenced this issue Jan 1, 2022
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

2 participants