Jason R. Coombs <jar...@jaraco.com> added the comment: I find that on Python 2.7.3 64-bit Windows, the deletion of locale.encodings is also necessary:
PS C:\Users\jaraco> python Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> b'x'.decode('utf-8') u'x' >>> del sys.modules['encodings.utf_8'], sys.modules['encodings'] >>> b'x'.decode('utf-8') u'x' >>> ^Z PS C:\Users\jaraco> python Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> b'x'.decode('utf-8') u'x' >>> import locale; del locale.encodings # Not necessary with python2 >>> del sys.modules['encodings.utf_8'], sys.modules['encodings'] >>> b'x'.decode('utf-8') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\python\lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) AttributeError: 'NoneType' object has no attribute 'utf_8_decode' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14847> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com