Can include one .jl file but not another

I am trying to call julia files into the file I am currently working on. I can include Schneider et al 2016 parameter.jl and it calculates its values, but I get an error when I try to include Schneider et al functions harvest.jl" and I really don’t understand why.

The include command is formatted the same way:

include("C:\\Users\\Helga\\Documents\\Julia\\Julia WD\\phd-julia-code\\Schneider et al 2016 parameters.jl")
include("C:\\Users\\Helga\\Documents\\Julia\\Julia WD\\phd-julia-code\\Schneider et al functions harvest.jl")

And I know the name(directory) is correct because I copied the name from the file properties. What is happening?

could not open file C:\Users\Helga\Documents\Julia\Julia WD\phd-julia-code\Schneider et al functions harvest.jl
in top-level scope at base\none
in include at base\client.jl:403
in include at base\sysimg.jl:29
in include_relative at base\loading.jl:1038
in include at base\boot.jl:326 

Is it possible that you misspelled the path?

No, I copied the filepath name and put in the double \\. I removed and reinstalled Julia in case some weird error was causing it, but it still doesn’t work. I really am confused as to why its not working.

You can check if the path is correct using isfile. If it is then it’s another problem. Do you use the REPL ? recently I had some paths that didn’t work in Juno.

1 Like

What is the output of stat("C:\\Users\\Helga\\Documents\\Julia\\Julia WD\\phd-julia-code\\Schneider et al functions harvest.jl")?

I would try renaming “Schneider et al functions harvest.jl” to file2.jl and try including that. If that works, then the file is fine, so rename it back and try again. The renaming processes would also help ensure that the file name is really what you expect it to be…My guess is that it has a double space or maybe a non ascii character that you are not noticing.


Thanks for your help everyone! The typical error of staring too long at something :upside_down_face:

1 Like