OpenSSL error

dieter dieter at handshake.de
Fri Sep 7 01:50:12 EDT 2018


Peng Yu <pengyu.ut at gmail.com> writes:
> ...
>     from OpenSSL import rand, crypto, SSL
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/SSL.py",
> line 118, in <module>
>     SSL_ST_INIT = _lib.SSL_ST_INIT
> AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

That is strange.

The "_lib" actually comes from "cryptography.hazmat.bindings._openssl".
Apparently, it defines quite some of the SSL related constants
but not "SSL_ST_INIT".

A potential reason could be that
a wrong version of the "cryptography" packages is used, maybe
due to a bad "PYTHONPATH" or "sys.path" value. Import "cryptography"
and look at its "__file__" to verify where is comes from.

Another potential reason: the contents of "_lib" might depend
on the openssl system library. Then an incompatible version
of this library might cause the problem.




More information about the Python-list mailing list