Python SSLCertVerificationError #44
-
I'm trying to connect to my database with python 3.12 but I'm receiving an SSL error, here's the traceback SSLCertVerificationError Traceback (most recent call last)
File ~/GitHub/sae-team-center/.venv/lib/python3.12/site-packages/sqlitecloud/driver.py:163, in Driver._internal_connect(self, hostname, port, config)
162 try:
--> 163 sock.connect((hostname, port))
164 except Exception as e:
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py:1353, in SSLSocket.connect(self, addr)
1351 \"\"\"Connects to remote ADDR, and then wraps the connection in
1352 an SSL channel.\"\"\"
-> 1353 self._real_connect(addr, False)
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py:1344, in SSLSocket._real_connect(self, addr, connect_ex)
1343 if self.do_handshake_on_connect:
-> 1344 self.do_handshake()
1345 return rc
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py:1320, in SSLSocket.do_handshake(self, block)
1319 self.settimeout(None)
-> 1320 self._sslobj.do_handshake()
1321 finally:
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
The above exception was the direct cause of the following exception:
SQLiteCloudException Traceback (most recent call last)
Cell In[16], line 1
----> 1 with sqlitecloud.connect(DATABASE_CONNECTION_STRING) as connection:
2 cursor = connection.execute(\"LIST INFO\")
3 print(cursor)
File ~/GitHub/sae-team-center/.venv/lib/python3.12/site-packages/sqlitecloud/dbapi2.py:180, in connect(connection_info, config, detect_types)
176 else:
177 config = SQLiteCloudConfig(connection_info)
179 connection = Connection(
--> 180 driver.connect(config.account.hostname, config.account.port, config),
181 detect_types=detect_types,
182 )
184 return connection
File ~/GitHub/sae-team-center/.venv/lib/python3.12/site-packages/sqlitecloud/driver.py:58, in Driver.connect(self, hostname, port, config)
41 def connect(
42 self, hostname: str, port: int, config: SQLiteCloudConfig
43 ) -> SQLiteCloudConnect:
44 \"\"\"
45 Connect to the SQLite Cloud server.
46
(...)
56 SQLiteCloudException: If an error occurs while connecting the socket.
57 \"\"\"
---> 58 sock = self._internal_connect(hostname, port, config)
60 connection = SQLiteCloudConnect()
61 connection.config = config
File ~/GitHub/sae-team-center/.venv/lib/python3.12/site-packages/sqlitecloud/driver.py:166, in Driver._internal_connect(self, hostname, port, config)
164 except Exception as e:
165 errmsg = \"An error occurred while initializing the socket.\"
--> 166 raise SQLiteCloudException(errmsg) from e
168 return sock
SQLiteCloudException: An error occurred while initializing the socket. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
update: This error appeared on Mac OS, after trying on Windowns it worked perfectly |
Beta Was this translation helpful? Give feedback.
-
@caio-pavesi it seems that the issue is due to an incorrect OpenSSL installation on Mac OS. From the log I can see: |
Beta Was this translation helpful? Give feedback.
-
@caio-pavesi search and execute |
Beta Was this translation helpful? Give feedback.
@caio-pavesi search and execute
Install Certificates.command
in the Applications -> Python folder. It seems that Python doesn't have the certificates needed to verify ours.