I’m sorry to bother with such a seemingly trivial problem but I’m stuck with a stupid problem. I have a simple file that I’d like to read.
open(path) do f
readdlm(f,header=true)[1]
end
where path contains the absolute path to the file. This command works perfectly fine as the matrix contained in the file is correctly returned.
However, if I use the same path to call cat, then it pretends the file is non-existent.
julia> `cat $path`
`cat 'C:\Users\dehaybe\OneDrive - UCL\Doctorat\julia\BalancedMinimumEvolution\data\01-Primates12.txt'`
julia> run(`cat $path`)
ERROR: IOError: could not spawn `cat 'C:\Users\dehaybe\OneDrive - UCL\Doctorat\julia\BalancedMinimumEvolution\data\01-Primates12.txt'`: no such file or directory (ENOENT)
Stacktrace:
[1] _spawn_primitive(file::String, cmd::Cmd, stdio::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
@ Base .\process.jl:128
[2] #784
@ .\process.jl:139 [inlined]
[3] setup_stdios(f::Base.var"#784#785"{Cmd}, stdios::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
@ Base .\process.jl:223
[4] _spawn
@ .\process.jl:138 [inlined]
[5] run(::Cmd; wait::Bool)
@ Base .\process.jl:479
[6] run(::Cmd)
@ Base .\process.jl:477
[7] top-level scope
@ REPL[47]:1
It works for me in the Windows Terminal but can’t get it to work in run either, so perhaps the Windows Terminal does something fancy? But Julia is running in the Windows Terminal, so shouldn’t that be where this command is being sent?
This is wrong, it forces -i filename to be a single string. This means the executable will receive it as a single argument while it expects a -i argument followed by a filename argument. Try this instead: