LoadError:SystemError:opening file XXX: permission denied

The command I type in:

julia xxx.jl 1 100 1 400 output.txt &

xxx is the filename.

Error:

LoadError:SystemError:opening file XXX: permission denied

OS:Ubuntu
julia version:1.9.3

This my first time running julia in linux and don’t know how to solve it.

Ok - just from how you wrote the command, I suspect that you probably meant to write something like julia xxx.jl 1 100 1 100 > output.txt, however, we have no idea what you are trying to do, so:

First, check ownership/permissions on the file (note specifically that I have read permissions on the file):

frylock@thing:~$ ls -lh command_line_args.jl
-rw-r--r-- 1 frylock frylock 55 Oct 19 07:19 command_line_args.jl

Next, you didn’t give us an example (just that alone makes it very hard to help you), here is what I am using:

frylock@thing:~$ cat command_line_args.jl
println(PROGRAM_FILE)
for x in ARGS
    println(x)
end

Here is what I get when I run that:

frylock@thing:~$ julia command_line_args.jl 1 100 1 100
command_line_args.jl
1
100
1
100
1 Like

Thank you for your answer!

I have solved the problem by this command

sudo chown -R username filename

Sorry for the inaccurate description that may confuse you.
I am not a native English speaker and trying to improve it :wink:

So - this is offtopic for Julia, but if you are sharing files amongst a group you could consider setting your group or “other” permissions on files that you share. Unix permissions are a lot less complicated than Windows access control lists (and in my opinion, harder to mess up as badly).

You could have also (probably) fixed it by changing the file permissions to 644 or 640 if you were in the same group. The 4 in the second octal digit represents “read” permissions for the group that owns the file, and the 4 in the first digit represents “read” permissions for “other” (i.e. everybody on the computer).

I’m sure you are better at the translation than I am, but Google seems to have a webpage translator available that may help when difficulties arise.