gpt4 book ai didi

python - Heroku 权限错误 : [Errno 13] Permission denied

转载 作者:行者123 更新时间:2023-12-04 23:19:40 24 4
gpt4 key购买 nike

我是 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构建包,它会抛出错误ClientException: ffmpeg.exe was not found.
  • 最佳答案

    Heroku 让您可以访问在后台使用 linux 发行版的虚拟 shell。鉴于 *.exe文件不在 linux 中运行(至少不能直接运行),您将无法使其运行。此外,出于安全原因(以及其他原因),他们不应该让人们在某些目录上写入或执行任意二进制文件,例如您的 ffmpeg.exe。 .
    首先确保您能够连接到上述 shell 并尝试运行 ffmpeg .如果您无法运行它,您应该在 GitHub repo 中创建一个问题它提供了您提到的构建包,解释了您遇到的问题。

    关于python - Heroku 权限错误 : [Errno 13] Permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69216841/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com