首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >导入CGIHTTPServer结果UnicodeDecodeError

导入CGIHTTPServer结果UnicodeDecodeError
EN

Stack Overflow用户
提问于 2014-04-06 09:03:47
回答 1查看 135关注 0票数 0

在Python2.7.6上导入CGIHTTPServer结果UnicodeDecodeError。

代码语言:javascript
复制
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\CGIHTTPServer.py", line 30, in <module>
    import SimpleHTTPServer
  File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
    class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  File "C:\Python27\lib\SimpleHTTPServer.py", line 208, in SimpleHTTPRequestHand
    ler
    mimetypes.init() # try to read system mime.types
  File "C:\Python27\lib\mimetypes.py", line 358, in init
    db.read_windows_registry()
  File "C:\Python27\lib\mimetypes.py", line 258, in read_windows_registry
    for subkeyname in enum_types(hkcr):
  File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
    ctype = ctype.encode(default_encoding) # omit in 3.x!
 UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 0: ordinal
 not in range(128)" 

请告诉我。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-06 09:11:27

这是Python2.7中的一个bug,报告为第21138期mimetypes模块没有对mimetypes注册表中的Unicode mimetype使用正确的编码。

bug票据包含一个工作;您必须编辑mimetypes.py

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22891968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档