NameError:未定义名称“ABNF”

时间:2014-02-14 03:27:51

标签: python pebble-watch

创建新的Pebble项目时出现此错误

shatekar-mbp:workspace SagarHatekar$ pebble new-project hello-world
[DEBUG   ] [Analytics] header: {'User-Agent': 'Pebble SDK/2.0.0 (Darwin-13.0.0-x86_64-i386-64bit-python-2.7.3)'}, data: {'ck': '2.7.3', 'cn': 'Darwin-13.0.0-x86_64-i386-64bit', 'cid': 'ac9248aa-9366-4714-a965-0d2a4903349e', 'tid': 'UA-30638158-7', 't': 'event', 'v': 1, 'cs': 'ac9248aa-9366-4714-a965-0d2a4903349e'}
category: install
action: import
label: fail: missing import: name 'ABNF' is not defined
value: 0
Traceback (most recent call last):
  File "/Users/SagarHatekar/dev/pebble/sdk/bin/../tools/pebble.py", line 20, in 
    from pebble.PblBuildCommand     import (PblBuildCommand,
  File "/Users/SagarHatekar/dev/pebble/sdk/tools/pebble/PblBuildCommand.py", line 12, in 
    from LibPebblesCommand import (NoCompilerException, BuildErrorException,
  File "/Users/SagarHatekar/dev/pebble/sdk/tools/pebble/LibPebblesCommand.py", line 7, in 
    import pebble as libpebble
  File "/Users/SagarHatekar/dev/pebble/sdk/tools/pebble/pebble.py", line 21, in 
    import WebSocketPebble
  File "/Users/SagarHatekar/dev/pebble/sdk/tools/pebble/WebSocketPebble.py", line 21, in 
    class WebSocketPebble(WebSocket):
  File "/Users/SagarHatekar/dev/pebble/sdk/tools/pebble/WebSocketPebble.py", line 25, in WebSocketPebble
    def write(self, payload, opcode = ABNF.OPCODE_BINARY, ws_cmd = WS_CMD_PHONE_TO_WATCH):
NameError: name 'ABNF' is not defined

感谢任何帮助。

2 个答案:

答案 0 :(得分:6)

问题在于你的websocket和websocket-client。

卸载websocketwebsocket-client,然后使用pip requirements.txt

重新安装
pip uninstall websocket websocket-client
pip install -r PebbleSDK-2.0-BETA2/requirements.txt

答案 1 :(得分:0)

在我来说,websocket-client库的缺失是问题所在。要解决它:

pip install websocket-client