jazzband / Watson

:watch: A wonderful CLI to track your time!
http://tailordev.github.io/Watson/
MIT License
2.44k stars 239 forks source link

Watson Sync prompts "No JSON object could be decoded" #208

Open dungerdunger opened 6 years ago

dungerdunger commented 6 years ago

Hello!

I am using Watson on Ubuntu Bash installed on Windows 10 Subsystem for Linux. Everything works great except when I try to "watson sync" with my crick api, I get this message:

image

Appears to be something with JSON and/or python and/or pip. I've tried installing and re-installing these things to no avail. Any thoughts on what might be going on here? Any help is much appreciated!

jmaupetit commented 6 years ago

How have you configured the Crick backend? Are you using your own instance of Crick?

dungerdunger commented 6 years ago

I have an account set up on crick.io and have "https://api.crick.io/watson" and my token set up under [backend] in my watson config file. It works fine when I sync on iMac, but I get the aforementioned error when I try to sync on my new Windows laptop. My guess is that I've somehow configured something wrong somewhere in setting up Watson and/or Ubuntu Bash, but my trial and error so far has accomplished nothing.

svHatch commented 5 years ago

I'm getting this error as well on Elementary OS Luna (Ubuntu 18.04 LTS), as well as Windows 10 set up with Anaconda (pip 18.1)

gustawdaniel commented 5 years ago

I reproduced this error but with other console log:

Traceback (most recent call last):
  File "/home/daniel/.local/bin/watson", line 7, in <module>
    from watson.__main__ import cli
  File "/home/daniel/.local/lib/python2.7/site-packages/watson/__main__.py", line 6, in <module>
    cli.cli()
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/daniel/.local/lib/python2.7/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/daniel/.local/lib/python2.7/site-packages/watson/cli.py", line 995, in sync
    pulled = watson.pull()
  File "/home/daniel/.local/lib/python2.7/site-packages/watson/watson.py", line 336, in pull
    dest, headers = self._get_request_info('frames')
  File "/home/daniel/.local/lib/python2.7/site-packages/watson/watson.py", line 305, in _get_request_info
    "You must specify a remote URL (backend.url) and a token "
watson.watson.ConfigurationError: You must specify a remote URL (backend.url) and a token (backend.token) using the config command.

I remember that I synchronized with watson one time it is described there

https://tailordev.fr/blog/2017/06/07/le-lab-5-crick-a-backend-for-watson-time-tracker/

I think to fix this issue we need catch this error and convert it to simple friendy to end user tutorial about possible synchronization options

Related / blocking issues

https://github.com/TailorDev/Watson/issues/165


I had hope that I can write simple turorial because of I had setup synchronization with crick ealier but untortunatelly now I have error.

Setps to reproduce:

1) I installed crick cli. 2) Following after https://tailordev.fr/blog/2017/06/07/le-lab-5-crick-a-backend-for-watson-time-tracker/ I connected cli with app.crick.io (logged in by github) 3) I created some time frames by cli and send to backend. Ok. 4) I lost my crick instance, removed or changed computer, I do not rememeber. Anyway I installed new fresh crick cli. 5) I logged into app.crick.io and have seen my token (clicking on avatar and next on my token) 6) I typed in console

watson config backend.url https://app.crick.io/watson
watson config backend.token <MY_TOKEN>

I do not have any time frame. I typed

watson sync

And there is error:

Traceback (most recent call last):
  File "/home/daniel/.local/bin/watson", line 7, in <module>
    from watson.__main__ import cli
  File "/home/daniel/.local/lib/python2.7/site-packages/watson/__main__.py", line 6, in <module>
    cli.cli()
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/daniel/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/daniel/.local/lib/python2.7/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/daniel/.local/lib/python2.7/site-packages/watson/cli.py", line 995, in sync
    pulled = watson.pull()
  File "/home/daniel/.local/lib/python2.7/site-packages/watson/watson.py", line 351, in pull
    frames = response.json() or ()
  File "/home/daniel/.local/lib/python2.7/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Additional info

watson --version
Watson, version 1.6.0
Ubuntu 18
python --version
Python 2.7.15rc1
python3 --version
Python 3.6.7

Please catch this exception and convert it to human readable reason and instruction wat goes wrong.