python script aborts on Ubuntu 16.04: No JSON object could be decoded

M. Fioretti mfioretti at nexaima.net
Mon Aug 27 18:13:39 UTC 2018


Hello,

I am trying to run this Python script:

https://github.com/virtadpt/Experiments/blob/master/unmark_dump_to_shaarli.py

to import a collection of bookmarks in a test install, on the SAME 
Ubuntu box,
of the the Shaarli bookmark manager 
https://shaarli.readthedocs.io/en/master/

After installing the python-jwt and python-requests modules, the script 
starts but fails with the error message below. The behavior does not 
change at all if, instead of reading the data to import from a file, I 
hardwire them into the script itself one by one, i.e. if I add 
statements like:

new_bookmark["url"] = "http://www.ubuntu.com"

I have already asked for support on the shaarli developers forum. I am 
also asking here to be sure that it is not some Ubuntu-specific issue, 
i.e. python modules packaging issues, extra settings needed, whatever.

Any help greatly appreciated,

TIA,

Marco


DEBUG: New Shaarli bookmark: {'url': 'http://www.ubuntu.com', 
'description': 'this is the description of the test link', 'private': 
True, 'title': 'testing shaarli with some page'}
{"url": "http://www.ubuntu.com", "description": "this is the description 
of the test link", "private": true, "title": "testing shaarli with some 
page"}
INFO: Sending link http://www.ubuntu.com
INFO: Starting new HTTP connection (1): 127.0.0.1
DEBUG: "POST /shaarli/ HTTP/1.1" 200 2345
Traceback (most recent call last):
   File "./unmark_dump_to_shaarli.py", line 162, in <module>
     logger.debug(json.dumps(response.json()))
   File "/usr/lib/python2.7/dist-packages/requests/models.py", line 808, 
in json
     return complexjson.loads(self.text, **kwargs)
   File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
     return _default_decoder.decode(s)
   File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
     raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded




-- 
http://mfioretti.com



More information about the ubuntu-users mailing list