如何解决“权限被拒绝”的问题当我尝试运行外部 Perl 脚本时?

发布于 2024-09-25 16:04:08 字数 179 浏览 0 评论 0原文

system("logscr.ply ");

我得到的错误是这样的:

Can't exec "logscr.ply": Permission denied at eal.ply line 3

为什么我会收到错误,如何修复它?

system("logscr.ply ");

The error I get is this:

Can't exec "logscr.ply": Permission denied at eal.ply line 3

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦年海沫深 2024-10-02 16:04:08

在不知道更多细节的情况下,可能有多种原因:

  • 您的示例代码表明您正在尝试执行“logscr.ply”。末尾的空格字符可能会被解析为文件名的一部分。不过,这应该会产生文件未找到的错误。
  • 被调用脚本的保护位可能不允许直接执行。在命令提示符下尝试 chmod u+x logscr.ply
  • 您可能无法访问包含logscr.ply 的文件夹。确保您具有读取和执行权限(尝试 chmod u+r,u+x 文件夹名称 )。
  • 被调用的脚本可能无法将自身识别为 Perl 脚本,请尝试 system("perllogscr.ply");。
  • $PATH 中较早的位置可能存在同名文件。在调用中使用绝对路径来防止这种情况 (system("perl /some/path/logscr.ply");),不要依赖 $PATH 变量。

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.
风尘浪孓 2024-10-02 16:04:08

这是什么平台/操作系统?

可能 logscr.ply 只是没有设置执行权限。例如,在 Linux/Unix 上,您应该执行此操作

chmod u+x logscr.ply

,然后重试。

注意:这假设您是 logscr.ply 的所有者。如果不是,请进行相应调整。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文