我在编码方面相当陌生,我正在尝试在我的 Sikuli 代码中使用 PushBullet API(来自Azelphur )。我使用 pip 安装 PushBullet 及其依赖项。以下代码在 Atom 编辑器中完美运行,但在 Sikuli 中出现错误:
from pushbullet.pushbullet import pushbullet
apiKey = "EXAMPLE"
send = PushBullet(apiKey)
devices = send.getDevices()
send.pushNote(devices[0]["iden"], "Hello World", "Test")
在 Sikuli IDE 中,我添加了这些路径(之前无法找到模块):
import sys
sys.path.append("/Library/Python/2.7/site-packages")
sys.path.append("/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python")
然而它返回这个:
[error] script [ pushsample ] stopped with error in line 5
[error] AttributeError ( 'module' object has no attribute 'SOL_TCP' )
[error] --- Traceback --- error source first
line: module ( function ) statement
30: _socket ( <module> ) DEFAULT_SOCKET_OPTION = [(socket.SOL_TCP, socket.TCP_NODELAY, 1)]
31: _http ( <module> ) from ._socket import*
29: _handshake ( <module> ) from ._http import *
33: _core ( <module> ) from ._handshake import *
35: _app ( <module> ) from ._core import WebSocket, getdefaulttimeout
23: __init__ ( <module> ) from ._app import WebSocketApp
18: pushbullet ( <module> ) from websocket import create_connection
[error] --- Traceback --- end --------------
为什么它可以在 Atom 而不是 Sikuli IDE 中工作(现在我已经添加了路径)?谢谢你的任何想法!