ellielinc
ellielinc

Reputation: 85

Cannot open file in Julia

Just pulled a repository from GitHub and saved in under Downloads. Trying to run the program and keep getting these errors:

    julia> using FITSIO

    julia> include("readoifits.jl")
    ERROR: could not open file /home/ellie/Downloads/readoifits.jl
    in include_from_node1(::String) at ./loading.jl:488

    julia> include("setupft.jl")
    ERROR: could not open file /home/ellie/Downloads/setupft.jl
    in include_from_node1(::String) at ./loading.jl:488

    julia> include("oichi2.jl")
    ERROR: could not open file /home/ellie/Downloads/oichi2.jl
    in include_from_node1(::String) at ./loading.jl:488

    julia> include("oiplot.jl")
    ERROR: could not open file /home/ellie/Downloads/oiplot.jl
    in include_from_node1(::String) at ./loading.jl:488

So it knows the file exists and where it's located, yet can't open them. Can someone please explain what node1 and the String bit mean and how to open these files? Thanks.

Upvotes: 2

Views: 4268

Answers (2)

ellielinc
ellielinc

Reputation: 85

Problem resolved.

Needed to go deeper into the path. Before opening Julia, I changed the directory to

    cd /home/ellie/Downloads

Should have gone one deeper to the file it was under

    cd/home/ellie/Downloads/OITOOLS.jl

Beginner's mistake :)

Upvotes: 1

StefanKarpinski
StefanKarpinski

Reputation: 33290

What is your current directory? You appear to be running the REPL in the Downloads directory – which maybe has your data in it but not your code? You can find out the current directory with the pwd() function. The include function in the REPL opens files relative to the current working directory, which is the directory you were in when you started the Julia process. (When called from another source file, include looks for files relative to the directory of that source file.)

Upvotes: 5

Related Questions