My company just updated our RDS databases yesterday in AWS and suddenly I’m getting a strange error in an previously working app.
AttributeError: module ‘ssl’ has no attribute ‘wrap_socket’
After some searching I found it could be a no longer supported function in Python. There were a few suggested changes which I have tried and the best I can do is get to a point of: Lost connection to MySQL server at ‘127.0.0.1:9198’, system error: 524297 [SSL] PEM lib (_ssl.c:3917)
#self.sock = ssl.wrap_socket(
# self.sock, keyfile=key, certfile=cert, ca_certs=ca,
# cert_reqs=cert_reqs, do_handshake_on_connect=False,
# ssl_version=ssl.PROTOCOL_TLSv1, ciphers=cipher)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_verify_locations(ca)
context.load_cert_chain(certfile=cert, keyfile=key)
context.set_ciphers(cipher)
self.socket = context.wrap_socket(self.socket, server_side=False, do_handshake_on_connect=False)
The commented out section is what was previously what I had and the un-commented is what I changed it to that I’m getting the new error on.
Any ideas as to why I can’t connect would be appreciated?
arbennett4 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.