Python笔记本无法正确加载

时间:2014-05-12 09:09:17

标签: ipython

我使用的是Anaconda 2.76版本。它一直工作到今天。笔记本页面未正确加载。 Noe的功能是响应。在我做了一些研究后,我认为这是一些编码错误,但由于我真的不是一个计算类型的人,我不知道到底出了什么问题以及如何解决它。以下是我收到的错误消息。请帮我一把。非常感谢。

HTTPRequest (protocol=’http’, host =’127.0.0.1:8888;,method=’GET’,uri=’/static/base/images/favicon.ico’,version=’HTTP/1.1’,remote_ip-‘127.0.0.1’,headers={‘connection’:’keep-alive’,’Accept-Language’:’zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4’,’Accept-Encoding’:’gzip,deflate,sdch’,'host’:'127.0.0.1:8888’,Accept':'*/*','User-Agent':'Mozilla/5.0(windows NT 6.1; WOW64)AppleWebKit/537.36(KHTML,like Gecko)Chrome/34.0.1847.131 Safari/537.36'})

Traceback (most recent call last):
File "D:|Anaconda\lib\site-packages\tornado\web.py", line 1218, in _when_complete
callback()
File "D:|Anaconda\lib\site-packages\tornado\web.py", Line 1239, in _execute_method
self._when_coplete(method(*self.path_args,**self.path_kwargs),
File "D:|Anaconda\lib\site-packages\IPython\html\base\handlers.py", line 318, in get
mime_type, encoding=mimetypes.guess_type(abspath)
File "D:\Anaconda\lib\mimetypes.py", line 297, in guess_type
init()
File "D:\Anaconda\lib\mimetypes.py", line 358,in init
db.read_windows_registry()
File "D:\Anaconda\lib\mimetypes.py", line 258,in read_windows_registry
for subkeyname in enum_types(hkcr):
File "D:\Anaconda\lib\mimetypes.py", line 249,in enum_types
ctype=ctype.encode(default_encoding)#omit in 3.X!
UnicodeDecodeError: "ascii" codec can't decode byte 0*b0 in position 1:ordinal not in range(128)
2014-5-12 16:43:45.456 [tornado.access] ERROR |500 GET /static/base/images/favicon.ico (127.0.0.1) 97.00ms`

1 个答案:

答案 0 :(得分:1)

这是known issue

我使用以下临时修改Anaconda / Lib / mimetypes.py,第252-253行(如建议here)解决了同样的问题。

try:
  ctype = ctype.encode(default_encoding) # omit in 3.x!
except UnicodeEncodeError:
  pass
except Exception: #<--
  pass            #<--
else:
  yield ctype