0

Python is using old SSL lib and throws an error when trying to connect to newer TLD protocol.

Error from python

ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661)

Python shows old version of OpenSSL even though I've upgraded:

python -c "import ssl; print ssl.OPENSSL_VERSION"
OpenSSL 0.9.8zh 14 Jan 2016

OpenSSL version

openssl version -a                                                             (master✱)
OpenSSL 1.0.2d 9 Jul 2015
built on: reproducible build, date unspecified
platform: darwin64-x86_64-cc
options:  bn(64,64) rc4(ptr,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: /usr/bin/clang -I. -I.. -I../include  -fPIC -fno-common -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/opt/local/etc/openssl"

I've tried all the things on Stackoverflow regarding upgrading python, installing python from python.org, upgrading OpenSSL via brew, relinking OpenSSL via brew (doesn't work, not allowed), symlinking/updating ssl libs and binaries, restarting terminal.

Python path

python -c "import sys; print sys.path"
['', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/matt/Library/Python/2.7/lib/python/site-packages', '/usr/local/lib/python2.7/site-packages', '/usr/local/Cellar/numpy/1.13.3/libexec/nose/lib/python2.7/site-packages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages']
Matt
  • 3,483
  • 4
  • 36
  • 46
  • seems this is a common problem for many, a straightforward one-solution-fix-all doesn't appear to exist, have you tried this person's suggestion? [Python referencing old SSL version](https://stackoverflow.com/a/46308535/1248974) – chickity china chinese chicken Mar 02 '18 at 19:33
  • @davedwards I suppose I'll give that a shot. It _does_ seem like a problem of the Python.framework overriding but I was hesitant to just `sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7` – Matt Mar 03 '18 at 00:38
  • 1
    Yeah good thing you didn't do that, that's the MacOS built-in system python that the OS needs – chickity china chinese chicken Mar 03 '18 at 00:41

0 Answers0