JunoLab / Weave.jl

Scientific reports/literate programming for Julia
http://weavejl.mpastell.com
MIT License
830 stars 96 forks source link

Error about finding `plots.jl` file #288

Closed ssfrr closed 4 years ago

ssfrr commented 4 years ago

It looks like Weave.jl is trying to find a file plots.jl relative to the current working directory. I my notebooks I often set the directory explicitly for searching for local resources, data etc. Recently it started throwing this error. It doesn't seem to negatively affect the operation - I still get my render out.

I'm using Weave v0.9.1, from within Atom/Juno using language-weave v0.6.7.

julia> [ Info: Weaving chunk 1 from line 41
(compiled mode) evaluation error starting at /home/sfr/research_journal/2020/02/28/full_data_sdr/no
ne:0
  could not open file /home/sfr/research_journal/2020/02/28/full_data_sdr/plots.jl
Stacktrace:
 [1] include at ./boot.jl:328 [inlined]
 [2] include_relative(::Module, ::String) at ./loading.jl:1105
 [3] include(::Module, ::String) at ./Base.jl:31
 [4] top-level scope at none:0
while evaluating
begin
    Base.include(Main, "plots.jl")
    __pkguuid__ = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
end
in module Weave
ssfrr commented 4 years ago

whoops, just realized I'm not on the latest Weave.jl. Updating seems to have resolve the issue. Sorry for the noise!

ssfrr commented 4 years ago

Whoops, actually after a fresh Julia reboot it seems I'm seeing the issue again.

shg commented 4 years ago

I see the same. Base.include in the __init__() function in Weave.jl seems to search the file to include in the current directory instead of in the Weave module directory. The following fix solved the issue here.

function __init__()
    @require Plots="91a5bcdd-55d7-5caf-9e0b-520d859cae80" Base.include(Main, joinpath(dirname(pathof(Weave)), "plots.jl"))
    @require Gadfly="c91e804a-d5a3-530f-b6f0-dfbca275c004" Base.include(Main, joinpath(dirname(pathof(Weave)), "gadfly.jl"))
end