Aboo
Aboo

Reputation: 1

Error while trying to run a discord bot (python)

File "dban.py", line 1, in <module>
    import discord
  File "C:\Users\mabou\Desktop\Python\lib\site-packages\discord\__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "C:\Users\mabou\Desktop\Python\lib\site-packages\discord\client.py", line 38, in <module>
    from .state import ConnectionState
  File "C:\Users\mabou\Desktop\Python\lib\site-packages\discord\state.py", line 36, in <module>
    from . import utils, compat
  File "C:\Users\mabou\Desktop\Python\lib\site-packages\discord\compat.py", line 32
create_task = asyncio.async
                          ^
SyntaxError: invalid syntax

How do I fix these errors?

Upvotes: -1

Views: 226

Answers (1)

Jab
Jab

Reputation: 27515

Found this comment to this issue on github.

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 don't know what python version you're using for sure but I can assume you're using Python 3.7 and Dicsord.py master/async branch. Either use Python 3.6 or below, or download the re-write.

If I remember correctly the pip install is:

python3 -m pip install -U https://github.com/Rapptz/discord.py/archive/master.zip#egg=discord.py[voice]

You can also get quicker more relevant help on the discord.py server

Upvotes: 1

Related Questions