Discord.py: create_task = asyncio.async: SyntaxError: invalid syntax

Created on 5 Jul 2018  Â·  6Comments  Â·  Source: Rapptz/discord.py

Getting this error after updating Python to 3.7.0

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import discord
  File "/Users/alex/code/leader-bot/venv/lib/python3.7/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "/Users/alex/code/leader-bot/venv/lib/python3.7/site-packages/discord/client.py", line 38, in <module>
    from .state import ConnectionState
  File "/Users/alex/code/leader-bot/venv/lib/python3.7/site-packages/discord/state.py", line 36, in <module>
    from . import utils, compat
  File "/Users/alex/code/leader-bot/venv/lib/python3.7/site-packages/discord/compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

Most helpful comment

Discord.py async does not work at all on 3.7, please downgrade to 3.6.X
Rewrite somewhat works but you should just stick to 3.6

All 6 comments

Discord.py async does not work at all on 3.7, please downgrade to 3.6.X
Rewrite somewhat works but you should just stick to 3.6

Duplicate of #1249 and #1393.

Thank you.

from version 3.4
asycn and await are reserved keywords

like the error in below image

enter image description here

copy the link up to directory/folder name( not include __init__.py)
you will get a list of .py files
enter image description here

rename async file to _async or asynch or anything u want as async is now a reserved keyword with us from version 3.4

once renamed than open check in all files where we have import async
modify the new name every where

and enjoy

@ErMSDandyan async and await are only reserved in 3.7 onwards. Renaming library files or folders is not a good idea as it both creates inconsistency in your install and may confuse pip or setuptools if you decide to upgrade those libraries.

It also doesn't help for this issue, where asyncio.async is used. Modifying asyncio in this way will damage your install and prevent discord.py, or really any async library, from operating correctly.

Use an older version or use the rewrite branch to fix these issues.

I just followed the resolution i found on github
They have provided this resolution

So it worked for me so updated

Sent from my iPhone

On 21-Aug-2018, at 04:10, Devon R notifications@github.com wrote:

@ErMSDandyan async and await are only reserved in 3.7 onwards. Renaming library files or folders is not a good idea as it both creates inconsistency in your install and may confuse pip or setuptools if you decide to upgrade those libraries.

It also doesn't help for this issue, where asyncio.async is used. Modifying asyncio in this way will damage your install and prevent discord.py, or really any async library, from operating correctly.

Use an older version or use the rewrite branch to fix these issues.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pappabewar picture pappabewar  Â·  26Comments

Yuvira picture Yuvira  Â·  18Comments

johndoe434 picture johndoe434  Â·  21Comments

Shea4 picture Shea4  Â·  21Comments

ThePiGuy24 picture ThePiGuy24  Â·  17Comments