【发布时间】:2016-05-17 03:43:52
【问题描述】:
我正在 bluemix 上编写一个 websocket 程序,并遇到了 import create_connection 的一些问题: 从 websocket 导入 create_connection ImportError: 无法导入名称 create_connection
我可以知道解决方法是什么。我正在使用 python 2.7 在 IBM Bluemix 上运行
添加细节: 我已经在 Python notebook 中安装了 websocket 包,然后运行了这段代码:
6 import websocket
7 print 'before connection'
----> 8 ws = websocket.create_connection("ws://tryandbuyoncloud.stage1.mybluemix.net/ws/Test")
10 print "Sending 'Hello, World'..."
AttributeError: 'module' object has no attribute 'create_connection'
-达塔
【问题讨论】:
-
Heu Datta,你能提供完整的日志输出和你的代码吗?
-
您有列出正确依赖项的 requirements.txt 文件吗?
-
嗨,我没有 requirements.txt,因为我使用的是 python 笔记本,而不是在 bluemix 上部署应用程序。
-
嗨霍伯特,我已经添加了程序和错误详细信息。
标签: python-2.7 websocket ibm-cloud