asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
651 stars 56 forks source link

Python certificates in Ubuntu #97

Open claudio-dalicandro opened 3 years ago

claudio-dalicandro commented 3 years ago

Hi! I am trying to use an emacs package that makes use of python, currently I have set 3.8.6 as global version, but I get an error that googling seems to exist only in macOs (I am using ubuntu)

Error hitting url https://floobits.com/api/orgs/can/admin: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1124)

I have already reported this error to the authors of the package (https://github.com/Floobits/floobits-emacs/issues/100), but I doubt that maybe this depends on my python installation, does this seem plausible to you?

cho-m commented 3 years ago

Just a comment that error seems to just be about SSL certificate issues.

Looking at the package you mentioned, the error is happening at: https://github.com/Floobits/floobits-emacs/blob/master/floo/common/api.py#L125-L128

    cafile = os.path.join(G.BASE_DIR, 'floobits.pem')
    with open(cafile, 'wb') as cert_fd:
        cert_fd.write(cert.CA_CERT.encode('utf-8'))
    return urlopen(r, timeout=10, cafile=cafile)

You might want to make sure CA File ~/floobits/floobits.pem is valid/not-expired.

Other online topics on error are just related to updating your system SSL certificate files (using command on macOS or just pip install --upgrade certifi on other systems), but I am not familiar with the exact SSL flow. Setting cafile=cafile may just override the system certificates.