开发者

How do I fix "Permission denied" when I try to run an external Perl script?

开发者 https://www.devze.com 2023-01-18 11:04 出处:网络
system(\"logscr.ply \"); The error I get is this: Can\'t exec \"logscr.ply\": Permission denied at e开发者_JS百科al.ply line 3
system("logscr.ply ");

The error I get is this:

Can't exec "logscr.ply": Permission denied at e开发者_JS百科al.ply line 3

Why am I getting the error, and how do I fix it?


Without knowing any more details, there could be a variety of reasons:

  • Your example code states you're trying to execute "logscr.ply ". The space character at the end might be parsed as part of the file name. This should yield a file-not-found error, though.
  • The protection bits for the called script might not allow for direct execution. Try chmod u+x logscr.ply from your command prompt.
  • The folder containing logscr.ply might not be accessible to you. Make sure you have both read and execute permission on it (try chmod u+r,u+x folder-name).
  • The called script might not recognize itself as a Perl script, try system("perl logscr.ply");.
  • There might be a file with the same name somewhere earlier in your $PATH. Use absolute paths in your call to prevent this (system("perl /some/path/logscr.ply");), don't rely on your $PATH variable.


What platform/OS is this?

Probably logscr.ply just does not have execute permissions set. On Linux/Unix e.g. you should do

chmod u+x logscr.ply

then try again.

Note: This assumes you are the owner of logscr.ply. If not, adjust accordingly.

0

精彩评论

暂无评论...
验证码 换一张
取 消