Python [Invalid syntax] with async def

前端 未结 3 589
北海茫月
北海茫月 2021-01-07 16:28

I am trying write discord bots using Python, I have come across and threw together this bot.

import discord
import asyncio
import random

client = discord.Cl         


        
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-07 16:58

    From version 3.7 async and await are reserved keywords

    like the error in below image.

    Copy and open the path (without __init__.py). You will get a list of .py files

    Rename async.py to _async.py or anything you want, as async is now a reserved keyword with us from version 3.7.

    Once renamed, modify the new name everywhere.

    *NOTE Although it is not a permanent solution but it worked for me in case of the same syntax error while working with firebase. Best solution is to go with previous version of Python. i.e version below 3.7.

提交回复
热议问题