Python Savoir API "no json object could be decoded"

+1 vote
Hi,

 I was trying to test the code under : https://github.com/DXMarkets/Savoir. 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 "ptest.py", line 12, in <module>
    print(api.getinfo())
  File "/usr/lib/python2.7/site-packages/Savoir/Savoir.py", line 65, in __call__
    log.error("Json: %s" % r.json())
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 850, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", 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
...