discord.ext.commands.errors.CommandInvokeError: Command raised an exception: PermissionError: [WinError 5] Отказано в доступе
Хочу чтобы бот воспроизводил музыку из ютуба но пишет ошибку
import random
import datetime as dt
import discord
import json
from discord.ext import commands
import pyttsx3
from youtube_dl import YoutubeDL
from asyncio import sleep
YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist':'False'}
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
TOKEN = ''
bot = commands.Bot(command_prefix='!')
@bot.command()
async def play(ctx, arg):
global vc
try:
voice_channel = ctx.message.author.voice.channel
vc = await voice_channel.connect()
except:
print('Уже подключен или не удалось подключиться')
if vc.is_playing():
await ctx.send(f'{ctx.message.author.mention}, музыка уже проигрывается.')
else:
with YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(arg, download=False)
URL = info['formats'][0]['url']
vc.play(discord.FFmpegPCMAudio(executable=r"""C:\Users\Budan\Desktop\Новая папка (13)\ffmpeg-snapshot\ffmpeg""", source=URL, **FFMPEG_OPTIONS))
while vc.is_playing():
await sleep(1)
if not vc.is_paused():
await vc.disconnect()
Ошибка:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: PermissionError: [WinError 5] Отказано в доступе
Ответы (1 шт):
Автор решения: itskekoff
→ Ссылка
Ваш код не может получить доступ в ту или иную папку. Запустите код от имени администратора и все заработает.