Can't get pebble javascript simulator (pypkjs) running

322 Views Asked by At

I'm trying to setup the PebbleKit JS Simulator to be able to fully develop without the Pebble-Watch itself. I installed the simulator as instructed on their github repo, however when running the simulator as indicated on their github I am getting errors and I cannot figure out why. I reinstalled several times and the errors stick. (I have the QEMU-Emulator installed and it's working fine)

It seems like the JS-Simulator is not able to connect to the QEMU-Emulator. Here's my terminal output when running ./phonesim.py without an open QEMU:

Namespace(debug=False, layout=None, oauth=None, pbws=[], persist=None, port=9000, qemu='127.0.0.1:12344', ssl_root=None, token=None)
['127.0.0.1', '12344']
INFO:pypkjs:Ready. Loaded apps:
Traceback (most recent call last):
  File "./phonesim.py", line 31, in <module>
    runner.run()
  File "/Users/manuelburger/pypkjs/runner/websocket.py", line 56, in run
    pebble_greenlet = self.pebble.connect()
  File "/Users/manuelburger/pypkjs/pebble_manager.py", line 29, in connect
    self.pebble.connect()
  File "/Library/Python/2.7/site-packages/libpebble2/communication/__init__.py", line 56, in connect
    self.transport.connect()
  File "/Library/Python/2.7/site-packages/libpebble2/communication/transports/qemu/__init__.py", line 53, in connect
    raise ConnectionError(str(e))
libpebble2.exceptions.ConnectionError: [Errno 61] Connection refused

And this is the output when running ./jskit.py localhost:12344 watchface1.pbw with the QEMU running watchface1.pbw:

['localhost', '12344']
Traceback (most recent call last):
  File "./jskit.py", line 28, in <module>
    runner = TerminalRunner(sys.argv[1], sys.argv[2:], "data")
  File "/Users/manuelburger/pypkjs/runner/terminal.py", line 15, in __init__
    super(TerminalRunner, self).__init__(*args, **kwargs)
  File "/Users/manuelburger/pypkjs/runner/__init__.py", line 37, in __init__
    self.timeline = PebbleTimeline(self, persist=persist_dir, oauth=oauth_token, layout_file=layout_file)
  File "/Users/manuelburger/pypkjs/timeline/__init__.py", line 33, in __init__
    model.prepare_db(self.persist_dir + '/timeline.db')
  File "/Users/manuelburger/pypkjs/timeline/model.py", line 312, in prepare_db
    db.connect()
  File "/Library/Python/2.7/site-packages/peewee.py", line 2811, in connect
    self.__local.closed = False
  File "/Library/Python/2.7/site-packages/peewee.py", line 2732, in __exit__
    reraise(new_type, new_type(*exc_value.args), traceback)
  File "/Library/Python/2.7/site-packages/peewee.py", line 2810, in connect
    **self.connect_kwargs)
  File "/Library/Python/2.7/site-packages/peewee.py", line 3016, in _connect
    conn = sqlite3.connect(database, **kwargs)
peewee.OperationalError: unable to open database file

Any help and suggestions to solve this problem are greatly appreciated.

1

There are 1 best solutions below

0
Dale On

A couple of things I found:

  1. my default port is NOT 12344. run 'ps -ax | grep qemu' while it's running and you can see what port is being used. Mine connects via 'localhost:41968'. There's probably a better way to get qemu's actual port, but this works.

  2. for phonesim.py, you need to specify the connection to qemu and the port, which again you can copy from the output of the ps command above. For example, in my case it fails unless I run it as './phonesim.py --qemu localhost:41968'

  3. jskit is failing trying to open the database 'data/timeline.db', so you need to create a subdir named 'data' in the folder where you're running jskit from. It'd be nice if jskit created that folder for you but it doesn't seem to.

Hope that helps!