PubChemPy icon indicating copy to clipboard operation
PubChemPy copied to clipboard

SSLCertVerificationError while running the simplest of PubChemPy examples

Open aromring opened this issue 1 year ago • 16 comments

The following example from PCP documentation: import pubchempy as pcp c = pcp.Compound.from_cid(5090) print(c.molecular_formula) results in `SSLCertVerificationError Traceback (most recent call last) File c:\Python312\Lib\urllib\request.py:1344, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args) 1343 try: -> 1344 h.request(req.get_method(), req.selector, req.data, headers, 1345 encode_chunked=req.has_header('Transfer-encoding')) 1346 except OSError as err: # timeout error

File c:\Python312\Lib\http\client.py:1336, in HTTPConnection.request(self, method, url, body, headers, encode_chunked) 1335 """Send a complete request to the server.""" -> 1336 self._send_request(method, url, body, headers, encode_chunked)

File c:\Python312\Lib\http\client.py:1382, in HTTPConnection._send_request(self, method, url, body, headers, encode_chunked) 1381 body = _encode(body, 'body') -> 1382 self.endheaders(body, encode_chunked=encode_chunked)

File c:\Python312\Lib\http\client.py:1331, in HTTPConnection.endheaders(self, message_body, encode_chunked) 1330 raise CannotSendHeader() -> 1331 self._send_output(message_body, encode_chunked=encode_chunked)

File c:\Python312\Lib\http\client.py:1091, in HTTPConnection._send_output(self, message_body, encode_chunked) 1090 del self._buffer[:] -> 1091 self.send(msg) 1093 if message_body is not None: 1094 ... -> 1347 raise URLError(err) 1348 r = h.getresponse() 1349 except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get issuer certificate (_ssl.c:1000)>` I can browse to https://pubchem.ncbi.nlm.nih.gov/ without a problem and search for CID=5090 delivers rofecoxib. How to fix it? BTW, I am on Windows 10, not MAC

aromring avatar Aug 01 '24 17:08 aromring