[issue37079] PEM cadata causes ssl.SSLError: nested asn1 error

Christian Heimes report at bugs.python.org
Tue May 28 11:04:42 EDT 2019


Christian Heimes <lists at cheimes.de> added the comment:

The documentation refers to ASCII string as Python 3-style ASCII text object. In Python 2, that's the unicode data type. The feature was backported from Python 3. I guess the documentation was directly taken from Python 3's documentation and not updated to reflect Python 2's quirky str type.

You can use the io module to get the proper text type on Python 2 and 3.

import io
with io.open('ca.crt') as f:
    ca_crt = f.read()

----------
resolution:  -> not a bug
status: open -> pending
type: crash -> behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37079>
_______________________________________


More information about the Python-bugs-list mailing list