~/.local/discord.py > python3 [G:async[9M] 1863a1c ?]
Python 3.7.0 (default, Sep 15 2018, 19:13:07)
[GCC 8.2.1 20180831] on linux
Type "help", "copyright", "credits" or "license" for more information.
import discord
Traceback (most recent call last):
File "", line 1, in
File "/home/god/.local/discord.py/discord/__init__.py", line 20, in
from .client import Client, AppInfo, ChannelPermissions
File "/home/god/.local/discord.py/discord/client.py", line 42, in
from .voice_client import VoiceClient
File "/home/god/.local/discord.py/discord/voice_client.py", line 43, in
import websockets
File "/usr/lib/python3.7/site-packages/websockets/__init__.py", line 3, in
from .client import *
File "/usr/lib/python3.7/site-packages/websockets/client.py", line 12, in
from .protocol import CONNECTING, OPEN, WebSocketCommonProtocol
File "/usr/lib/python3.7/site-packages/websockets/protocol.py", line 17, in
from .compatibility import asyncio_ensure_future
File "/usr/lib/python3.7/site-packages/websockets/compatibility.py", line 9
asyncio_ensure_future = asyncio.async # Python < 3.5
^
SyntaxError: invalid syntax
exit()
The 0.16.x version of the lib doesn't support Python 3.7.
You will have to use a lower python install e.g 3.6.6. Alternatively you can switch to the rewrite version of lib which does support 3.7.
Install:
pip install -U git+https://github.com/Rapptz/discord.py@rewrite
Another possible solution I found was rewriting line 32 in compat.py
with
try:
create_task = asyncio.ensure_future
except AttributeError:
create_task = getattr(asyncio, "async") #asyncio.async
Thanks for everyones help
Unfortunately compat.py isn't the only thing that is broken with 3.7. There is a whole multitude of things that would need adjusting/fixing including dependencies. Since 0.16.x is feature frozen, altering the lib to a point 3.7 is fully bug free compatible, is probably out of the question.
The best thing you can do is downgrade your Python to 3.6.6.
Or as I said if you need/really want 3.7, upgrading your lib to the rewrite branch.
Also note, this is a duplicate of #1249 and #1401.
Most helpful comment
The 0.16.x version of the lib doesn't support Python 3.7.
You will have to use a lower python install e.g
3.6.6. Alternatively you can switch to the rewrite version of lib which does support 3.7.Install:
pip install -U git+https://github.com/Rapptz/discord.py@rewriteDocs:
https://discordpy.readthedocs.io/en/rewrite/api.html