eventlet
eventlet copied to clipboard
GreenSSLSocket does not have a public constructor
Hey, I send a email with celery, however, any exception like that: GreenSSLSocket does not have a public constructor. Instances are returned by SSLContext.wrap_socket(). my code just is shown below:
@celery_app.task
def send_mail(to, subject=None, content=None):
import smtplib
from email.mime.text import MIMEText
sender = "[email protected]"
passwd = "xxx"
status = {'status': None, 'info': None}
try:
msg = MIMEText(content, 'plain', 'utf-8')
msg['Subject'] = subject
msg['From'] = sender
msg['TO'] = to
smtp = smtplib.SMTP_SSL('smtp.qq.com', 465)
smtp.login(sender, passwd)
smtp.sendmail(sender, to, msg.as_string())
status.update(status='ok', info='send email successfully.')
except (Exception, ) as e:
print(e)
status.update(status='fail', info='send email fail, more:%s' % (e.__str__()))
return status
celery command: $ celery worker -A celeryconfig -l info -P eventlet
if celery work with gevent lib(with option '-P gevent'), it's works!
i wanna to know what can i do, if i use celery with eventlet. pip list show eventlet's version is 0.24.1
I have the same issue. This seems like a Python 3.7 compatibility issue and being fixed in the master branch. Either use Python 3.6 or the master branch.
https://github.com/eventlet/eventlet/pull/531
Maybe I just wait for the next stable release. Hope it comes sooner!
I think this one was fixed in 0.25.0. Not completely sure because after updating I still suffer from #526
I am also having the same issue while using flask-mail. My python version is 3.9.5