title: Discord.py ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]
body: <p>TLDR: I've been trying to use discord.py on my mac for a while, but everything I've tried doesnt work. All the other solutions dont work!</p>
  <p>Please help. I've been trying to get Discord.py to work for months now, and I can't get it to work. Here's my code [I'll reset my token, obviously]:</p>
  <pre><code>import discord
  
  
  class MyClient(discord.Client):
      async def on_ready(self):
          print('Logged on as', self.user)
  
      async def on_message(self, message):
          # don't respond to ourselves
          if message.author == self.user:
              return
  
          if message.content == 'ping':
              await message.channel.send('pong')
  
  
  client = MyClient()
  
  
  client.run(&quot;NzQxNzUzMTQ0MDA2MTQ4MTU2.Xy8Jcg.wBNInfNrj--ZtinuzQ-b4I7H1jo&quot;)
  </code></pre>
  <p>Which results in the folowing error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/aiohttp/connector.py&quot;, line 936, in _wrap_create_connection
      return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
    File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py&quot;, line 1050, in create_connection
      transport, protocol = await self._create_connection_transport(
    File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py&quot;, line 1080, in _create_connection_transport
      await waiter
    File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/sslproto.py&quot;, line 529, in data_received
      ssldata, appdata = self._sslpipe.feed_ssldata(data)
    File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/sslproto.py&quot;, line 189, in feed_ssldata
      self._sslobj.do_handshake()
    File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py&quot;, line 944, in do_handshake
      self._sslobj.do_handshake()
  ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/python_bot.py&quot;, line 18, in &lt;module&gt;
      client.run(&quot;NzQxNzUzMTQ0MDA2MTQ4MTU2.Xy8Jcg.wBNInfNrj--ZtinuzQ-b4I7H1jo&quot;)
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/discord/client.py&quot;, line 708, in run
      return future.result()
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/discord/client.py&quot;, line 687, in runner
      await self.start(*args, **kwargs)
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/discord/client.py&quot;, line 650, in start
      await self.login(*args, bot=bot)
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/discord/client.py&quot;, line 499, in login
      await self.http.static_login(token.strip(), bot=bot)
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/discord/http.py&quot;, line 291, in static_login
      data = await self.request(Route('GET', '/users/@me'))
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/discord/http.py&quot;, line 185, in request
      async with self.__session.request(method, url, **kwargs) as r:
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/aiohttp/client.py&quot;, line 1012, in __aenter__
      self._resp = await self._coro
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/aiohttp/client.py&quot;, line 480, in _request
      conn = await self._connector.connect(
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/aiohttp/connector.py&quot;, line 523, in connect
      proto = await self._create_connection(req, traces, timeout)
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/aiohttp/connector.py&quot;, line 858, in _create_connection
      _, proto = await self._create_direct_connection(
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/aiohttp/connector.py&quot;, line 1004, in _create_direct_connection
      raise last_exc
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/aiohttp/connector.py&quot;, line 980, in _create_direct_connection
      transp, proto = await self._wrap_create_connection(
    File &quot;/Users/meow/programming/PycharmProjects/BulmeniBot/venv/lib/python3.8/site-packages/aiohttp/connector.py&quot;, line 938, in _wrap_create_connection
      raise ClientConnectorCertificateError(
  aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')]
  
  Process finished with exit code 1
  
  </code></pre>
  <p>I'm on mac, using python 3.8 with Pycharm.</p>
  <h2>What I have tried:</h2>
  <p>After some Googling, I got to <a href="https://github.com/Rapptz/discord.py/issues/4159" rel="nofollow noreferrer">this</a> thread, which in turn led me <a href="https://github.com/Rapptz/discord.py/issues/423#issuecomment-272093801" rel="nofollow noreferrer">here</a>. Double clicking on <code>Install Certificates.command</code> gives me this error:</p>
  <pre><code>subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8', '-E', '-s', '-m', 'pip', 'install', '--upgrade', 'certifi']' returned non-zero exit status 1.
  </code></pre>
  <p>After some more googling, that lead me to <a href="https://bugs.python.org/issue36340" rel="nofollow noreferrer">this</a> thread, which doesnt tell me anything since I'm just using my terminal. :(</p>
  <p>I've tried <code>pip install --upgrade certifi</code> too, but the errors still remains. So what do I do?</p>