create_task = asyncio.async: SyntaxError: invalid syntax

后端 未结 2 1319
星月不相逢
星月不相逢 2020-12-03 07:50

I\'m creating a bot for Discord, and I just wrote this simple code:

import discord

TOKEN = \"token\"

client = discord.Client()


@client.event
async def on         


        
相关标签:
2条回答
  • 2020-12-03 08:07

    Where does the error come from?

    The version of discord.py you are using does not support Python 3.7 (in which async becomes a reserved keyword), as explained in this issue. This version of discord.py, which is the default branch on the GitHub repo, is sadly the one installed by Pip.

    How to fix it

    You can either:

    • downgrade your version of Python to 3.6.
    • install another version of discord.py, based on the rewrite branch which is under active development, for example with the command : python3 -m pip install --user -U https://github.com/Rapptz/discord.py/archive/rewrite.zip
    0 讨论(0)
  • 2020-12-03 08:25

    You can manually edit the file and change that line from create_task = asyncio.async to create_task = getattr(asyncio, 'async')

    See more info here: https://github.com/Rapptz/discord.py/issues/1249

    0 讨论(0)
提交回复
热议问题