$ openssl req -new -newkey rsa:3072 -sha256 -x509 -days 365 -nodes -out certkey.pem -keyout certkey.pem -subj "/O=selfsigned" $ cat test.py import ssl ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) ctx.load_cert_chain('certkey.pem', None) $ python2.7 test.py Traceback (most recent call last): File "test.py", line 3, in ctx.load_cert_chain('certkey.pem', None) TypeError: coercing to Unicode: need string or buffer, NoneType found $ python3 test.py