2

I'm rather new at coding, I'm trying to use the PushBullet API (from Azelphur) in my Sikuli code. I used pip to install PushBullet and its dependencies. The following code functions perfectly in the Atom editor, but hits errors in Sikuli:

from pushbullet.pushbullet import pushbullet

apiKey = "EXAMPLE"
send = PushBullet(apiKey)

devices = send.getDevices()

send.pushNote(devices[0]["iden"], "Hello World", "Test")

In Sikuli IDE I've added these paths (it was unable to find the modules before):

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")

However it returns this:

[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 --------------

Why would it work in Atom but not Sikuli IDE (now that I've added the paths)? Thank you for any ideas!

1 Answers1

0

Sikuli is based on Jython, not standard Python. Perhaps Atom uses Python interpreter to run the code, but Sikuli IDE uses Jython interpreter, and that might be the reason why it does not see module and cannot run it.

You may want to look into jpushbullet ( https://github.com/silk8192/jpushbullet ) and how to mix both Java and Python code in Jython / Sikuli.

RPWheeler
  • 86
  • 2
  • 5