ActivityWatch / aw-watcher-input

Track your keypresses and mouse movements with ActivityWatch
109 stars 20 forks source link

Bucket not created #10

Closed mosaleh52 closed 2 years ago

mosaleh52 commented 2 years ago

I have installed through

curl -sSL https://install.python-poetry.org | python3 -
cd  /tmp
poetry install

when running the watcher it was returning output in terminal put no effect in web UI raw data as mention in other closed problem #4 I change queued to false in aw-watch[input/src/main.py to false now when run it I have error that there is no bucket with this name should I create it manually and how

❯ pwd
/tmp/aw-watcher-input
❯ aw-watcher-input
zsh: command not found: aw-watcher-input
❯ poetry run aw-watcher-input --help
Usage: aw-watcher-input [OPTIONS]

Options:
  --testing
  --help     Show this message and exit.
❯ poetry run aw-watcher-input
INFO:aw_watcher_input.main:Starting watcher...
INFO:aw_watcher_input.main:No new input
WARNING:aw_client.client:404 Client Error: NOT FOUND for url: http://127.0.0.1:5600/api/0/buckets/aw-watcher-input_mo-lab/heartbeat?pulsetime=1.1
WARNING:aw_client.client:Error message received: {'message': "There's no bucket named aw-watcher-input_mo-lab. You have requested this URI [/api/0/buckets/aw-watcher-input_mo-lab/heartbeat] but did you mean /api/0/buckets/<string:bucket_id>/heartbeat ?"}
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/mo/.cache/pypoetry/virtualenvs/aw-watcher-input-u_zxqqLD-py3.9/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/mo/.cache/pypoetry/virtualenvs/aw-watcher-input-u_zxqqLD-py3.9/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/mo/.cache/pypoetry/virtualenvs/aw-watcher-input-u_zxqqLD-py3.9/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/mo/.cache/pypoetry/virtualenvs/aw-watcher-input-u_zxqqLD-py3.9/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmp/aw-watcher-input/src/aw_watcher_input/main.py", line 55, in main
    client.heartbeat(bucket_name, e, pulsetime=pulsetime, queued=False)
  File "/home/mo/.cache/pypoetry/virtualenvs/aw-watcher-input-u_zxqqLD-py3.9/lib/python3.9/site-packages/aw_client/client.py", line 243, in heartbeat
    return Event(**self._post(endpoint, event.to_json_dict()).json())
  File "/home/mo/.cache/pypoetry/virtualenvs/aw-watcher-input-u_zxqqLD-py3.9/lib/python3.9/site-packages/aw_client/client.py", line 44, in g
    raise e
  File "/home/mo/.cache/pypoetry/virtualenvs/aw-watcher-input-u_zxqqLD-py3.9/lib/python3.9/site-packages/aw_client/client.py", line 41, in g
    r.raise_for_status()
  File "/home/mo/.cache/pypoetry/virtualenvs/aw-watcher-input-u_zxqqLD-py3.9/lib/python3.9/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: NOT FOUND for url: http://127.0.0.1:5600/api/0/buckets/aw-watcher-input_mo-lab/heartbeat?pulsetime=1.1

    /tmp/aw-watcher-input    master !1   
ochen1 commented 2 years ago

Try manually creating the bucket.

I just did this by importing a fake JSON that I created myself, and it works!

For reference only, here was my JSON. If you wish to attempt the same trick, please be sure to replace the hostname with your own and (optionally) a more realistic creation timestamp.

{
   "buckets" : {
      "aw-watcher-input_hostname" : {
         "client" : "aw-watcher-input",
         "created" : "2022-01-08T19:17:19.456700+00:00",
         "events" : [],
         "hostname" : "hostname",
         "id" : "aw-watcher-input_hostname",
         "name" : null,
         "type" : "os.hid.input"
      }
   }
}
mosaleh52 commented 2 years ago

Try manually creating the bucket.

I just did this by importing a fake JSON that I created myself, and it works!

For reference only, here was my JSON. If you wish to attempt the same trick, please be sure to replace the hostname with your own and (optionally) a more realistic creation timestamp.

{
   "buckets" : {
      "aw-watcher-input_hostname" : {
         "client" : "aw-watcher-input",
         "created" : "2022-01-08T19:17:19.456700+00:00",
         "events" : [],
         "hostname" : "hostname",
         "id" : "aw-watcher-input_hostname",
         "name" : null,
         "type" : "os.hid.input"
      }
   }
}

It worked, thanks

for those who do not know how to make the watcher start in login, you could use this command since poetry should be run in the same directory (cd /home/mo/Downloads/aw-watcher-input && poetry run aw-watcher-input)

johan-bjareholt commented 2 years ago

The issue isn't really fixed. You shouldn't have to create the bucket manually, that's just a workaround.

ErikBjare commented 2 years ago

I think I fixed this in https://github.com/ActivityWatch/aw-watcher-input/commit/5ffcacd1940480f470f111f26d28fdb0e0e31ab7.

Please let me know if issues persist.

ErikBjare commented 2 years ago

I lied, finally fixed in https://github.com/ActivityWatch/aw-watcher-input/commit/9bb85c4fa4a4dc6c7307cdd5473ed80ba85bc921