0

I had the following line in my script, that stopped working after I formatted my computer:

client=MongoClient(address)

It started to generate the following error:

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)

The main change to my stack was updating from python 3.8.5 to 3.8.10, but upon reinstalling the old version, the error persisted.

I run python using venv, on windows10x64.

After searching I managed to get it working:

    import certifi
    client=MongoClient(address, tlsCAFile=certifi.where())

Still, I would like some help figuring out possible reasons for why it used to work without any explicit certificate as a parameter.

What kind of program/file/library could I have had on my computer that made this possible? Would it be possible that I had a certificate on my computer to which MongoClient defaulted to?

  • Perhaps one of the suggestions at https://stackoverflow.com/questions/39356413/how-to-add-a-custom-ca-root-certificate-to-the-ca-store-used-by-pip-in-windows was previously done? – Joe Jul 22 '21 at 00:04

1 Answers1

0

I encountered this problem with the pymongo package. I also had this SSL1131 error.

Later I thought that it might be a problem with the extension package itself.

Use pip uninstall pymongo to uninstall the package first, and then use pip install pymongo reinstall it, and it will be back to normal after reinstallation.

If the package you are using is not pymongo, then you can reinstall the package you use and try it.

Lucasz
  • 1,150
  • 9
  • 19