Discord.py: I get an SSL Error when running my bot

Created on 23 Jan 2018  路  9Comments  路  Source: Rapptz/discord.py

I get this error when running my bot:
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:777)]] Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x1055167f0>

Here's the code for the bot:

#!/usr/bin/env python3

import discord, asyncio

client = discord.Client()

@client.event
async def on_ready():
        print("Logged in as:")
        print("client.user.name")
        print("client.user.id")
        print("_" * 80)

@client.event
async def on_message():
        await client.say("hi")

client.run('token')

Why do I get this error and how can I fix it?

question

Most helpful comment

Common Issue on python 3.6 & OSX
Navigate to your Applications/Python 3.6/ folder and double click the Install Certificates.command to fix this

All 9 comments

Common Issue on python 3.6 & OSX
Navigate to your Applications/Python 3.6/ folder and double click the Install Certificates.command to fix this

Common Issue on python 3.6 & OSX
Navigate to your Applications/Python 3.6/ folder and double click the Install Certificates.command to fix this

I've had installed cerifi but it still does not work.

I am not using OSX, and have this issue. Win 7.

I am getting the same problem and Im using Windows 10, Python 3.8.2

Please don't necro old issues.

This new issue is #4159 please see here for the resolution.

I have the same problem and I'm running Python 3.7 on windows 10.

See the comment above for a resolution.

I'm on Mac Os X and use Python 3.8 and I tried to double click on installCertificates.command but I have this :

-- pip install --upgrade certifi
Collecting certifi
Using cached https://files.pythonhosted.org/packages/98/99/def511020aa8f663d4a2cfaa38467539e864799289ff354569e339e375b1/certifi-2020.4.5.2-py2.py3-none-any.whl
Installing collected packages: certifi
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/certifi'
Consider using the --user option or check the permissions.

WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Traceback (most recent call last):
File "", line 44, in
File "", line 24, in main
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
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.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

and it still not works

@Comdec35000

Please don't necro old issues.

Also try to sudo it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcoshuck picture marcoshuck  路  16Comments

imayhaveborkedit picture imayhaveborkedit  路  58Comments

Chicchi73930 picture Chicchi73930  路  17Comments

VoxelPrismatic picture VoxelPrismatic  路  16Comments

johndoe434 picture johndoe434  路  21Comments