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

M. Fioretti mfioretti at nexaima.net
Mon Aug 27 19:53:52 UTC 2018


On 2018-08-27 20:50, Oliver Grawert wrote:
> hi,
> 
>> Any help greatly appreciated,
> ...
>> ValueError: No JSON object could be decoded
> 
> a totally wild guess:
> 
> sudo apt install python-simplejson

Thanks Oli.

It does make some difference. If I rerun the script after installing 
this module, the result is whatI pasted below (the different URL is 
because this time I ran the script using the test file provided by its 
developer. But even if I run the version with hardwired values it is the 
same. So it is likely a library/python module version problem, at least 
partly. What next?

Thanks again,
Marco



DEBUG: New Shaarli bookmark: {'url': 
u'http://links.drwho.virtadpt.net/marks', 'tags': [], 'description': '', 
'private': True, 'title': u'Unmark'}
INFO: Sending link http://links.drwho.virtadpt.net/marks
INFO: Starting new HTTP connection (1): 127.0.0.1
DEBUG: "POST /shaarli HTTP/1.1" 301 308
DEBUG: "GET /shaarli/ HTTP/1.1" 200 2344
Traceback (most recent call last):
   File "./unmark_dump_to_shaarli-nolinks.py", line 149, 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/dist-packages/simplejson/__init__.py", line 
516, 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.scanner.JSONDecodeError: Expecting value: line 1 column 1 
(char 0)

-- 
http://mfioretti.com




More information about the ubuntu-users mailing list