Python:UnicodeDecodeError (2.7)
在win7*64安装Python2.7.6后,安装setuptools出错
google发现这是python 2.7的一个bug:
This is a bug in mimetypes, triggered by bad data in the registry. (рєфшю/AMR is not at all a valid MIME media type.)
Index: Lib/mimetypes.py =================================================================== --- Lib/mimetypes.py (revision 85786) +++ Lib/mimetypes.py (working copy) @@ -27,6 +27,7 @@ import sys import posixpath import urllib +from itertools import count try: import _winreg except ImportError: @@ -239,19 +240,11 @@ return def enum_types(mimedb): - i = 0 - while True: + for i in count(): try: - ctype = _winreg.EnumKey(mimedb, i) + yield _winreg.EnumKey(mimedb, i) except EnvironmentError: break - try: - ctype = ctype.encode(default_encoding) # omit in 3.x! - except UnicodeEncodeError: - pass - else: - yield ctype - i += 1 default_encoding = sys.getdefaultencoding() with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,