【问题标题】:Heroku PermissionError: [Errno 13] Permission deniedHeroku PermissionError:[Errno 13] 权限被拒绝
【发布时间】:2021-11-11 22:38:17
【问题描述】:

我是 Heroku 的新手,刚刚尝试部署一个 python 音乐不和谐机器人(从 GitHub 分支部署)。

部署成功,机器人正在工作。 但是,当我尝试播放音乐时,它给了我一个错误:

2021-09-17T01:24:43.596654+00:00 app[worker.1]: voice_channel.play(discord.FFmpegPCMAudio(executable="FFmpeg/bin/ffmpeg.exe", source=filename))
2021-09-17T01:24:43.596654+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/player.py", line 225, in __init__
2021-09-17T01:24:43.596656+00:00 app[worker.1]: super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
2021-09-17T01:24:43.596666+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/player.py", line 138, in __init__
2021-09-17T01:24:43.596668+00:00 app[worker.1]: self._process = self._spawn_process(args, **kwargs)
2021-09-17T01:24:43.596689+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/player.py", line 144, in _spawn_process
2021-09-17T01:24:43.596689+00:00 app[worker.1]: process = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, **subprocess_kwargs)
2021-09-17T01:24:43.596699+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/subprocess.py", line 951, in __init__
2021-09-17T01:24:43.596700+00:00 app[worker.1]: self._execute_child(args, executable, preexec_fn, close_fds,
2021-09-17T01:24:43.596708+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/subprocess.py", line 1823, in _execute_child
2021-09-17T01:24:43.596709+00:00 app[worker.1]: raise child_exception_type(errno_num, err_msg, err_filename)
2021-09-17T01:24:43.596743+00:00 app[worker.1]: PermissionError: [Errno 13] Permission denied: 'FFmpeg/bin/ffmpeg.exe'
2021-09-17T01:24:43.596743+00:00 app[worker.1]:
2021-09-17T01:24:43.596744+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
2021-09-17T01:24:43.596744+00:00 app[worker.1]:
2021-09-17T01:24:43.596746+00:00 app[worker.1]: Traceback (most recent call last):
2021-09-17T01:24:43.596778+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/client.py", line 343, in _run_event
2021-09-17T01:24:43.596780+00:00 app[worker.1]: await coro(*args, **kwargs)
2021-09-17T01:24:43.596788+00:00 app[worker.1]: File "/app/bot.py", line 665, in on_command_error
2021-09-17T01:24:43.596789+00:00 app[worker.1]: raise error
2021-09-17T01:24:43.596798+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
2021-09-17T01:24:43.596799+00:00 app[worker.1]: await ctx.command.invoke(ctx)
2021-09-17T01:24:43.596808+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
2021-09-17T01:24:43.596808+00:00 app[worker.1]: await injected(*ctx.args, **ctx.kwargs)
2021-09-17T01:24:43.596817+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped
2021-09-17T01:24:43.596817+00:00 app[worker.1]: raise CommandInvokeError(exc) from exc
2021-09-17T01:24:43.596833+00:00 app[worker.1]: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: PermissionError: [Errno 13] Permission denied: 'FFmpeg/bin/ffmpeg.exe'

bot.py中的问题:

voice_channel.play(discord.FFmpegPCMAudio(executable="FFmpeg/bin/ffmpeg.exe", source=filename))

ffmpeg.exe 的路径在 GitHub 存储库中已经正确;但它不起作用并给出此错误:

PermissionError: [Errno 13] Permission denied: 'FFmpeg/bin/ffmpeg.exe'

谁能帮忙?

谢谢

注意事项:

  • 我不知道如何在Heroku中添加FFmpeg,所以我手动将它添加到GitHub存储库中(上次我尝试在GitHub中不使用FFmpeg并为Heroku使用this构建包,它会抛出错误@987654327 @

【问题讨论】:

    标签: python heroku ffmpeg


    【解决方案1】:

    Heroku 让您可以访问在后台使用 linux 发行版的虚拟 shell。鉴于*.exe 文件不在Linux 中运行(至少不能直接运行),您将无法使其运行。此外,出于安全原因(以及其他原因),他们不应让人们在某些目录上写入或执行任意二进制文件,例如您的 ffmpeg.exe

    首先确保您能够连接到上述 shell 并尝试运行 ffmpeg。如果您无法运行它,您应该在 GitHub repo 中创建一个问题,提供您提到的构建包,解释您遇到的问题。

    【讨论】:

      猜你喜欢
      • 2015-07-17
      • 2016-07-25
      • 2018-11-18
      • 2020-07-01
      • 2016-11-12
      • 2019-11-09
      • 2020-06-06
      • 2020-02-27
      • 2017-10-25
      相关资源
      最近更新 更多