2

I am having an issue that is eerily similar to this post on SO. I cannot use the answer there because I am on Ubuntu, and brew is for Mac. When I try to launch my Django server, (python manage.py runsslserver) I get the following error:

AttributeError: 'module' object has no attribute 'PROTOCOL_TLSv1_2'

I know I have OpenSSL installed for Python, as when I run import ssl and then print ssl.OPENSSL_VERSION in my Python environment, I get:

OpenSSL 1.0.1f 6 Jan 2014

There must be something really simple I am missing here. Any help at all is appreciated.

ifconfig
  • 6,242
  • 7
  • 41
  • 65

1 Answers1

4

According to your question your are using Python 2.7.6. Looking at the documentation for ssl.PROTOCOL_TLSv1_2 you will see:

ssl.PROTOCOL_TLSv1_2
...Available only with openssl version 1.0.1+.
New in version 2.7.9.

Thus, you need at least version 2.7.9 of Python. Either you upgrade your system to get an newer version or get some pre-packaged newer Python version like Anaconda.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • I have python `2.7.6`. How would I update to `2.7.9` – ifconfig Sep 01 '17 at 18:02
  • 1
    @ifconfig: to cite the last sentence of my answer: *"Either you **upgrade your system** to get an newer version or get some pre-packaged newer Python version like Anaconda"*. – Steffen Ullrich Sep 01 '17 at 18:22
  • Okay, I found it. [PROTOCOL_TLSv1_2](https://docs.python.org/2/library/ssl.html#ssl.PROTOCOL_TLSv1_2) has been deprecated since 2.7.13, it should be replaced with `OP_NO_SSLv3`. – Itachi Jan 18 '18 at 10:00