尝试评估我的代码时在缓冲区警告中收到一些错误消息

Error (websocket): in callback `on-open': Cannot send message to a closed websocket: cl-struct-websocket-frame, text, "{\"header\":{\"msg_id\":\"14735853-0ed2-4ef4-8f5a-312a198dd251\", \"username\":\"username\"\, \"session\":\"ab484abf-d4e6-4f83-2c2-de1b65264780\", \"msg_type\":\"execute_request\"}, \"metadata\":{}, \"content\":{\"code\":\"__import__('sys').stdout.write(__import__('os').getcwd())\", \"silent\":true, \\"user_variables\":[], \"user_expressions\":{}, \"allow_stdin\":false}, \"parent_header\":{}}", nil, t
Error (websocket): in callback `on-open': Wrong type argument: arrayp, nil
Error (websocket): in callback `on-close': Wrong type argument: arrayp, nil

在ipython服务器端,我看到了此消息
2014-03-05 23:24:40.760 [NotebookApp] WARNING | Cross Origin WebSocket Attempt.
2014-03-05 23:24:40.761 [tornado.application] ERROR | Uncaught exception in /kernels/2691bbe3-ce95-439b-a9ce-97ec52c80988/shell
Traceback (most recent call last):
  File "/home/haroldwu/Python-test/lib/python3.3/site-packages/tornado/websocket.py", line 322, in wrapper
    return callback(*args, **kwargs)
  File "/home/haroldwu/Python-test/lib/python3.3/site-packages/IPython/html/base/zmqhandlers.py", line 114, in open
    raise web.HTTPError(404)
tornado.web.HTTPError: HTTP 404: Not Found

我做了什么:
  • 升级我的python virtualenv和全局环境
  • 的所有软件包
  • 升级所有系统软件包(Archlinux最新的64位)
  • 升级所有emacs软件包
  • 在网上搜索(但未找到有用的结果)

  • Ipython笔记本在几周前就可以在我的emacs上运行,但现在不知怎么了……
    我没有 Tornado 的经验。

    谢谢你的帮助!!! :)

    最佳答案

    我猜想emacs不会发送Notebook WS代码检查的Origin header 。请参阅我的评论https://github.com/ipython/ipython/issues/5525

    快速的解决方法是在/home/haroldwu/Python-test/lib/python3.3/site-packages/IPython/html/base/zmqhandlers.py:114中注释掉同一来源检查。

    您始终可以在parsed_originorigin函数中添加origin_headersame_origin()zmqhandlers.py的日志记录,并相应地修复emacs软件包。

    关于emacs - 尝试在Emacs中使用Ipython Notebook时Websocket出现错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22202182/

    10-13 08:51
    查看更多