alphascriptyt / Discord_Rewrite_Tutorials

The GitHub Page for my Python Discord Rewrite tutorial series.
57 stars 89 forks source link

episode 16 error #14

Open fco131 opened 3 years ago

fco131 commented 3 years ago

Traceback (most recent call last): File "main.py", line 1, in import discord File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/init.py", line 25, in from .client import Client File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 27, in import asyncio File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/init.py", line 21, in from .base_events import * File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/base_events.py", line 296 future = tasks.async(future, loop=self) ^ SyntaxError: invalid syntax  KeyboardInterrupt 

sam-march commented 2 years ago

I don't know if its the same error, but I'm getting

Traceback (most recent call last):
  File "/home/runner/Dark-Alley-Moderation-Bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 185, in wrapped
    ret = await coro(*args, **kwargs)
  File "main.py", line 93, in play
    await self.play_song(ctx, song)
  File "main.py", line 43, in play_song
    url = pafy.new(song).getbestaudio().url
AttributeError: module 'pafy' has no attribute 'new'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/Dark-Alley-Moderation-Bot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 1183, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/Dark-Alley-Moderation-Bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 904, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/runner/Dark-Alley-Moderation-Bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 194, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'pafy' has no attribute 'new'

I've read all the docs, and they say what I've done is correct, but I don't know. Looking at yours, the error is the line future = tasks.async(future, loop=self). Async defines commands and other things like that, should you have put this inside a async command, with await?