I do not understand why some functions and variables are not included properly in my project, and as a result, I get an error: UndefVarError: something
not defined. I am working with SymbolicWedderburn.jl (@abulak ). However, I think my questions are more general.
I am working in Windows. I have one directory where all of my packages are stored, namely: C:\Users\raven.julia\packages
When I am in the directory C:\Users\raven.julia\packages\SymbolicWedderburn\lbiby\examples If I run
Pkg.activate(@__DIR__)
Pkg.instantiate()
include(joinpath(@__DIR__, "ex_C2_linear.jl"))
include(joinpath(@__DIR__, "ex_S4.jl"))
include(joinpath(@__DIR__, "ex_motzkin.jl"))
include(joinpath(@__DIR__, "ex_robinson_form.jl"))
I get
Test Summary: | Pass Total Time
Decompose in basis | 16 16 0.2s
Test Summary: | Pass Total Time
induced Matrix Representation | 5 5 2.2s
ERROR: LoadError: UndefVarError: `AP` not defined
Stacktrace:
[1] top-level scope
@ c:\Users\raven\.julia\packages\SymbolicWedderburn\lbiby\examples\action_polynomials.jl:20
in expression starting at c:\Users\raven\.julia\packages\SymbolicWedderburn\lbiby\examples\action_polynomials.jl:20
in expression starting at c:\Users\raven\.julia\packages\SymbolicWedderburn\lbiby\examples\ex_S4.jl:6
I downloaded the SymbolicWedderburn package and stored it somewhere else, namely: F:\darsi\jl
Now, when I am in the directory F:\darsi\jl\SymbolicWedderburn.jl-master\examples if I run the same script, I get
Decompose in basis: Error During Test at f:\darsi\jl\SymbolicWedderburn.jl-master\examples\ex_C2_linear.jl:40
Got exception outside of a @test
UndefVarError: `StarAlgebras` not defined
Stacktrace:
[1] macro expansion
@ f:\darsi\jl\SymbolicWedderburn.jl-master\examples\ex_C2_linear.jl:43 [inlined]
[2] macro expansion
@ C:\Users\raven\AppData\Local\Programs\julia-1.10.4\share\julia\stdlib\v1.10\Test\src\Test.jl:1577 [inlined]
[3] top-level scope
@ f:\darsi\jl\SymbolicWedderburn.jl-master\examples\ex_C2_linear.jl:41
[4] include(fname::String)
@ Base.MainInclude .\client.jl:489
[5] top-level scope
@ f:\darsi\jl\SymbolicWedderburn.jl-master\examples\run_examples.jl:4
[6] eval
@ .\boot.jl:385 [inlined]
[7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base .\loading.jl:2076
[8] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
@ Base .\essentials.jl:892
[9] invokelatest(::Any, ::Any, ::Vararg{Any})
@ Base .\essentials.jl:889
[10] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
@ VSCodeServer c:\Users\raven\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeServer\src\eval.jl:271
[11] (::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\raven\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeServer\src\eval.jl:181
[12] withpath(f::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
@ VSCodeServer c:\Users\raven\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeServer\src\repl.jl:276
[13] (::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\raven\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeServer\src\eval.jl:179
[14] hideprompt(f::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
@ VSCodeServer c:\Users\raven\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeServer\src\repl.jl:38
[15] (::VSCodeServer.var"#67#72"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\raven\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeServer\src\eval.jl:150
[16] with_logstate(f::Function, logstate::Any)
@ Base.CoreLogging .\logging.jl:515
[17] with_logger
@ .\logging.jl:627 [inlined]
[18] (::VSCodeServer.var"#66#71"{VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\raven\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeServer\src\eval.jl:263
[19] #invokelatest#2
@ .\essentials.jl:892 [inlined]
[20] invokelatest(::Any)
@ Base .\essentials.jl:889
[21] (::VSCodeServer.var"#64#65")()
@ VSCodeServer c:\Users\raven\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeServer\src\eval.jl:34
Test Summary: | Error Total Time
Decompose in basis | 1 1 0.1s
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
in expression starting at f:\darsi\jl\SymbolicWedderburn.jl-master\examples\ex_C2_linear.jl:40
First, I do not understand why I get different errors. Second, whenever I kill the REPL and try to start from scratch then some variables are not defined.
Would you also tell me whether there is any difference where I define the directory of my new environment? Lastly, would you tell me why when I use a package sometimes I need to include some files from that package in my script and sometimes there is no need to include anything and everything seems connected inside that package? I do not know when a file from a package is automatically included in my script when I write using Name of that Package
and when is not.