Bug #116285 AttributeError: module 'ssl' has no attribute 'wrap_socket'

Submitted: 2 Oct 2024 14:47 Modified: 3 Oct 2024 21:02
Reporter: Daniel Leidert Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:8.0.15 OS:Debian (Sid)
Assigned to: Javier TreviƱo CPU Architecture:Any

[2 Oct 2024 14:47] Daniel Leidert
Description:
I receive the following error with Python 3.12:

```
  File "/usr/lib/python3/dist-packages/mysql/connector/__init__.py", line 173, in connect
    return MySQLConnection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mysql/connector/connection.py", line 102, in __init__
    self.connect(**kwargs)
  File "/usr/lib/python3/dist-packages/mysql/connector/abstracts.py", line 735, in connect
    self._open_connection()
  File "/usr/lib/python3/dist-packages/mysql/connector/connection.py", line 250, in _open_connection
    self._do_auth(self._user, self._password,
  File "/usr/lib/python3/dist-packages/mysql/connector/connection.py", line 155, in _do_auth
    self._socket.switch_to_ssl(ssl_options.get('ca'),
  File "/usr/lib/python3/dist-packages/mysql/connector/network.py", line 427, in switch_to_ssl
    self.sock = ssl.wrap_socket(
                ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'
```

This is due to Python 3.12 having removed the ssl.wrap_socket() function (see
https://docs.python.org/3.12/whatsnew/3.12.html#ssl).

How to repeat:
Just use the Python version of the connector with Python 3.12+. The affected code is still present in version 9.0.0 and thus still fails with the same error.
[3 Oct 2024 21:02] Daniel Leidert
This has been fixed already. During testing, I was still using an older version.  My mistake. This can be closed.
[4 Oct 2024 9:22] MySQL Verification Team
Thank you Mr. Leidert !!!

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.