python27中mimetypes.py的UnicodeDecodeError ctype = ctype.encode(default_encoding) # omit in 3.x!

2014-4-15 foooy Nginx

python27中 Lib\mimetypes.py的一个bug,属于 "def enum_types(mimedb)"函数:

安装扩展会报以下错误:

ctype = ctype.encode(default_encoding) # omit in 3.x!

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128)

 

解决办法打开 Python27\lib\mimetypes.py删除或者注释下面代码

try:
    ctype = ctype.encode(default_encoding) # omit in 3.x!
except UnicodeEncodeError:
    pass


标签: python

评论(0) 浏览(5522)

Powered by emlog 鄂ICP备14000186号-1 sitemap