2014-04-06 49 views
0

導入CGIHTTPServer結果Python 2.7.6上的UnicodeDecodeError。import 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)" 

請告訴我。

回答

0

這是Python 2.7中的一個錯誤,報告爲issue 21138; mimetypes模塊不會在Windows註冊表中使用Unicode mimetypes的正確編碼。

錯誤票包含解決方法;你必須編輯mimetypes.py