SSL Error (known SSL OSX issue?)



  • trying to run this code:

    import urllib.request

    req = urllib.request.Request('http://www.python.org')
    with urllib.request.urlopen(req) as response:
    the_page = response.read()
    print(the_page)

    will get me:

    Traceback (most recent call last):
    File "urllib/request.pyc", line 1318, in do_open
    File "http/client.pyc", line 1239, in request
    File "http/client.pyc", line 1285, in _send_request
    File "http/client.pyc", line 1234, in endheaders
    File "http/client.pyc", line 1026, in _send_output
    File "http/client.pyc", line 964, in send
    File "http/client.pyc", line 1400, in connect
    File "ssl.pyc", line 407, in wrap_socket
    File "ssl.pyc", line 814, in init
    File "ssl.pyc", line 1068, in do_handshake
    File "ssl.pyc", line 689, in do_handshake
    ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "<untitled>", line 4, in <module>
    File "urllib/request.pyc", line 223, in urlopen
    File "urllib/request.pyc", line 532, in open
    File "urllib/request.pyc", line 642, in http_response
    File "urllib/request.pyc", line 564, in error
    File "urllib/request.pyc", line 504, in _call_chain
    File "urllib/request.pyc", line 756, in http_error_302
    File "urllib/request.pyc", line 526, in open
    File "urllib/request.pyc", line 544, in _open
    File "urllib/request.pyc", line 504, in _call_chain
    File "urllib/request.pyc", line 1361, in https_open
    File "urllib/request.pyc", line 1320, in do_open
    urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>

    runs fine on my local python

    reference (relevant?):
    http://www.cdotson.com/2017/01/sslerror-with-python-3-6-x-on-macos-sierra/

    why am i doing this in drawbot?
    trying to get my students to get data from public APIs to generate text/images and post to twitter.

    i could:

    install drawbot as a module?
    roll my own version?



  • @chuckloyola It fails for me in the same way, but also in Terminal. I have no idea why. It's more a general Python issue rather than one with DrawBot it seems.



  • The link you reference indeed explains the problem. I tried the first solution but it doesn't help. I don't have that command file in my machine to try that.


Log in to reply