Python Savoir API "no json object could be decoded"

+1 vote

 I was trying to test the code under : I have two nodes on different server. I can use code to access the node on the save server. However, when I try to run similar code on another server, it gave the following error:

No handlers could be found for logger "Savoir"
Traceback (most recent call last):
  File "", line 12, in <module>
  File "/usr/lib/python2.7/site-packages/Savoir/", line 65, in __call__
    log.error("Json: %s" % r.json())
  File "/usr/lib/python2.7/site-packages/requests/", line 850, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python2.7/json/", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


Anyone has any suggestion?
asked Feb 1, 2017 by caoy

1 Answer

0 votes
I think it is better and easy to run multichain operations through terminal in a python program. I follow this approach and is very easy and also without bugs.

 A simple script to start with to read all the stream keys in a multichain blockchain.

import subprocess, json

#Multichain Path
path = "/home/user/multichain-1.0-beta-1/multichain-cli"
output = subprocess.check_output([path, "chain2", "liststreamkeys", "d", "*", "false", max_entries]).decode("utf-8")
print (json.loads(output))
answered May 9, 2017 by Varun