Search code examples
pythondiscord.pyyoutube-dlkeyerror

'Dislike_count' error when using youtube_dl on Replit.com


I'm making a discord Music Bot in python and everything works fine when I run the bot on my pc, but when I run it via Replit.com it returns an error.

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'dislike_count'

I know this error occurs because of a line in a DiscordUtils file dislikes = data['dislike_count'], so on my pc I can just comment that line out and everything works fine.

But on Replit.com there seems to be no way to change or modify installed library files, so how should I fix this issue? I also tried Heroku, but that is the same issue.

I hope someone can help me out, thanks in advance!


Solution

  • Okay so I found my fix on this website, thanks @Adid.

    The issue was with pafy and to fix this just run pip uninstall -y pafy in the terminal, followed by pip install git+https://github.com/Cupcakus/pafy and you should be fine.