STINNER Victor <victor.stin...@haypocalc.com> added the comment:

base64, bz2, hex, quopri, rot13, uu and zlib codecs (reintroduced recently by 
r86934, issue #7475) cannot be used by str.encode/bytes.decode, but with 
.transform() and .untransform() methods of bytes and str objects. But these 
methods were removed by r87176.

The last solution to use base64 codec is:

>>> import codecs
>>> codecs.lookup('base64').decode(b'YWJj\n')[0]
b'abc'
>>> codecs.lookup('base64').encode(b'YWJj\n')[0]
b'abc'

Or simply use directly the base64 module:

>>> import base64
>>> base64.decodebytes(b'YWJj\n')
b'abc'
>>> base64.encodebytes(b'abc')
b'YWJj\n'

base64, bz2, hex, quopri, rot13, uu and zlib codecs should be removed from 
encodings.aliases (because they introduced a confusion for Python 2 users), or 
removed completly (because it's easier to use directly the related module, eg. 
base64 or zlib).

----------
nosy: +haypo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10807>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to