Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classic Error plus some I didn't find in Issues #1461

Closed
Not-Nik opened this issue Jul 26, 2018 · 5 comments
Closed

Classic Error plus some I didn't find in Issues #1461

Not-Nik opened this issue Jul 26, 2018 · 5 comments

Comments

@Not-Nik
Copy link

Not-Nik commented Jul 26, 2018

Well, I downloaded the current version from GitHub and ran this command in the folder:
python3 -m pip install -U .[voice]
I tried to run this code:

import discord
import asyncio

client = discord.Client()

TOKEN = "Don't even think about it!"
PREFIX = ":"

@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')

@client.event
async def on_message(message):
    if message.content.startswith(PREFIX + 'test'):
        counter = 0
        await client.send_message(message.channel, 'Wow, I am amazing!')
    elif message.content.startswith(PREFIX + 'sleep'):
        await asyncio.sleep(5)
        await client.send_message(message.channel, 'Done sleeping!')

client.run(TOKEN)

and this errors were shown:

Traceback (most recent call last):
  File "/Users/nikolas/Documents/CaptianOverkill/CaptainOverkill.py", line 1, in <module>
    import discord
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/discord/client.py", line 42, in <module>
    from .voice_client import VoiceClient
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/discord/voice_client.py", line 43, in <module>
    import websockets
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websockets/__init__.py", line 3, in <module>
    from .client import *
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websockets/client.py", line 12, in <module>
    from .protocol import CONNECTING, OPEN, WebSocketCommonProtocol
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websockets/protocol.py", line 17, in <module>
    from .compatibility import asyncio_ensure_future
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/websockets/compatibility.py", line 9
    asyncio_ensure_future = asyncio.async           # Python < 3.5
                                        ^
SyntaxError: invalid syntax

If there is already a issue that solved this, just post it - it would be really helpful!

PS: I got python version 3.7 and YES I tried installing the old version from pip while using python 3.6.0

@Not-Nik Not-Nik changed the title Classic Error plus some I didn't found in Issues Classic Error plus some I didn't find in Issues Jul 26, 2018
@sethwheway
Copy link
Contributor

sethwheway commented Jul 26, 2018

That error is because the async branch is not compatible with 3.7. Double check you're installing and running dpy on 3.6.6. Though you'll be fine here for the moment, questions like these are better suited to the discord.py server in future

@Harmon758
Copy link
Contributor

Duplicate of #1401

@Not-Nik
Copy link
Author

Not-Nik commented Jul 26, 2018

I downloaded 3.6.6, ran the code in it and hell there are too many errors to count:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 601, in _create_direct_connection
    local_addr=self._local_addr)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 804, in create_connection
    sock, protocol_factory, ssl, server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 830, in _create_connection_transport
    yield from waiter
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py", line 505, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py", line 201, in feed_ssldata
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 304, in connect
    yield from self._create_connection(req)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 578, in _create_connection
    transport, proto = yield from self._create_direct_connection(req)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 624, in _create_direct_connection
    (req.host, req.port, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 1] Can not connect to discordapp.com:443 [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/nikolas/Documents/CaptianOverkill/CaptainOverkill.py", line 25, in <module>
    client.run(TOKEN)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 518, in run
    self.loop.run_until_complete(self.start(*args, **kwargs))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 489, in start
    yield from self.login(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 416, in login
    yield from getattr(self, '_login_' + str(n))(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 346, in _login_1
    data = yield from self.http.static_login(token, bot=is_bot)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/http.py", line 258, in static_login
    data = yield from self.request(Route('GET', '/users/@me'))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/http.py", line 137, in request
    r = yield from self.session.request(method, url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/client.py", line 555, in __iter__
    resp = yield from self._coro
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request
    conn = yield from self._connector.connect(req)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 314, in connect
    .format(key, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 1] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)]]

@Harmon758
Copy link
Contributor

Harmon758 commented Jul 26, 2018

This is a single SSLError and is a duplicate of #423.

@Not-Nik
Copy link
Author

Not-Nik commented Jul 26, 2018

Worked, thank you! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants