potassco / clingo

🤔 A grounder and solver for logic programs.
https://potassco.org/clingo
MIT License
599 stars 79 forks source link

When running .lp files on MacOS Ventura 13.2.1 using Apple Silicon M2 Max Chip, has <cmd> error that says "file cannot be opened". #410

Closed lzhao33573796 closed 1 year ago

lzhao33573796 commented 1 year ago

This is the detail for the problem: (py3.6) lxz@lxs-mbp ~ % clingo /Users/lxz/Documents/queens.lp -c n=12 0 clingo version 5.6.2 Reading from ...lxz/Documents/queens.lp

: error: file could not be opened: /Users/lxz/Documents/queens.lp *** ERROR: (clingo): parsing failed UNKNOWN Models : 0+ Calls : 1 Time : 0.001s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s) CPU Time : 0.001s However, changing the extension to .txt solved the problem. Already tried installing the package clingo-lp and clingo-lpx, did not resolve the issue.
rkaminsk commented 1 year ago

This is the error message you get if you try to open a file that does not exist or you do not have the permissions to read.

lzhao33573796 commented 1 year ago

This is the error message you get if you try to open a file that does not exist or you do not have the permissions to read.

Is there any way to solve this? Because for the same file, .txt works but .lp does not. The same file should have the same permission I assume?

daveraja commented 1 year ago

Can you explain what you mean by "for the same file"? Because "/Users/lxz/Documents/queens.lp" and "/Users/lxz/Documents/queens.txt" are paths to different files, unless both paths exist and one is a hard or symbolic link to the other.

Note, it is very unlikely that this is a bug either in Clingo or in the MacOS M2 standard library.

More likely is that you have a file named "/Users/lxz/Documents/queens.txt" but not one named "/Users/lxz/Documents/queens.lp". Or the file named "/Users/lxz/Documents/queens.lp" isn't readable as your login (for example, it was copy/created as the root user).

From a command prompt can you run "ls -al /Users/lxz/Documents/queens.*" to check?

On 1/3/23 14:23, lzhao33573796 wrote:

This is the error message you get if you try to open a file that
does not exist or you do not have the permissions to read.

Is there any way to solve this? Because for the same file, .txt works but .lp does not. The same file should have the same permission I assume?

— Reply to this email directly, view it on GitHub https://github.com/potassco/clingo/issues/410#issuecomment-1449276043, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHCLVTSFQDUAI6BHHQFMWDWZ26K5ANCNFSM6AAAAAAVLG6J3I. You are receiving this because you are subscribed to this thread.Message ID: @.***>

lzhao33573796 commented 1 year ago

Can you explain what you mean by "for the same file"? Because "/Users/lxz/Documents/queens.lp" and "/Users/lxz/Documents/queens.txt" are paths to different files, unless both paths exist and one is a hard or symbolic link to the other. Note, it is very unlikely that this is a bug either in Clingo or in the MacOS M2 standard library. More likely is that you have a file named "/Users/lxz/Documents/queens.txt" but not one named "/Users/lxz/Documents/queens.lp". Or the file named "/Users/lxz/Documents/queens.lp" isn't readable as your login (for example, it was copy/created as the root user). From a command prompt can you run "ls -al /Users/lxz/Documents/queens.*" to check? …

So for the same file, I mean if I start with an empty text file, after writing the rules, I can make this file have either an extension of .txt, or an extension of .pl. When I set the extension of this file to .txt, clingo runs it perfectly fine. However, if I set the extension of this file to .pl, clingo will throw the error message. I am guessing that somehow the .pl file may have a different permission. I will try again tomorrow when I have access to the same laptop.

rkaminsk commented 1 year ago

Maybe the OS is hiding the extension? Like Windows does by default? Have you checked the output of the commands:

cd /Users/lxz/Documents
ls -l
cat queens.lp
lzhao33573796 commented 1 year ago

Just got it solved. The OS named it queen.lp.txt and hide the .txt. I think that is all for my question.

Thank you for your help!

On Wed, Mar 1, 2023 at 00:22 Roland Kaminski @.***> wrote:

Maybe the OS is hiding the extension? Like Windows does by default? Have you checked the output of the commands:

cd /Users/lxz/Documents ls -l cat queens.lp

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/potassco/clingo/issues/410*issuecomment-1449475045__;Iw!!IKRxdwAv5BmarQ!Y5P_0_poX_VCmGNOZjAl2hknBee_wQ1eisLCdY04tH1-ywyUrgVEhHaLeXC_PCcTvl_laCtWGg7bakjnzupe9vtsDg$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ANOAFFJCZQNEZBYCOEHD2RDWZ32JLANCNFSM6AAAAAAVLG6J3I__;!!IKRxdwAv5BmarQ!Y5P_0_poX_VCmGNOZjAl2hknBee_wQ1eisLCdY04tH1-ywyUrgVEhHaLeXC_PCcTvl_laCtWGg7bakjnzuqp56vtBw$ . You are receiving this because you authored the thread.Message ID: @.***>