导入CGIHTTPServer结果UnicodeDecodeE

2024-04-26 07:03:35 发布

您现在位置:Python中文网/ 问答频道 /正文

在python2.7.6上导入CGIHTTPServer结果UnicodeDecodeError。你知道吗

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)" 

请告诉我。你知道吗


Tags: inpyreadinitwindowsliblinefile
1条回答
网友
1楼 · 发布于 2024-04-26 07:03:35

这是python2.7中的一个bug,报告为issue 21138mimetypes模块没有在Windows注册表中对Unicode mimetype使用正确的编码。你知道吗

错误通知单包含一个解决方法;您必须编辑mimetypes.py。你知道吗

相关问题 更多 >