Unexpected behaviour of include

pwd() and include() do not seem to agree on which working directory I am in.

Using Julia 1.5 on VS code. I have a directory structure resembling ./FolderA/FolderB with my files being in FolderB.

pwd() in the Julia REPL in VSCode returns “/…/FolderA”, so to access other code files intuitively one needs to

include("./FolderB/[FILE]")

this however gives the usual

ERROR: LoadError: could not open file /.../FolderB/FolderB/[FILE]

indicating that include believes I am already in FolderB. This behaviour does not change when moving around with cd().

Is this a bug, or is there some reason for this discrepancy? Also, when using Distributed this behaviour suddently changes and pwd() seems to accurately describe the working directory for different workers (i.e. @everywhere include("[FILE]") throws an error while @everywhere include("./FolderB/[FILE]") works as expected.

1 Like

Paths to include are always relative the calling file.

2 Likes

Then why does the outcome change in an @everywhere frame? I think the always in your statement is not true…