Riak Problem w/ Python Client "No JSON object could be decoded"

Bob Ippolito bob at redivi.com
Sat Aug 20 19:39:20 EDT 2011


On Sat, Aug 20, 2011 at 4:10 PM, idmartin <idmcraft at gmail.com> wrote:
> Ive been trying for a few days now to fix this, ive tried every single format
> ive seen in examples online and put a JSON approved object as a string (used
> several JSON validation sides to check) in and i continually get this
> message.
>
> Can anyone give me some seggestions?
>
> Module riakcontrol:128 in search
>>>  for r in query.reduce_sort().reduce_limit(5).run():
> Module riak.mapreduce:211 in run
>>>  result = t.mapred(self._inputs, query, timeout)
> Module riak.transports.http:221 in mapred
>>>  result = json.loads(response[1])
> Module json:326 in loads
>>>  return _default_decoder.decode(s)
> Module json.decoder:360 in decode
>>>  obj, end = self.raw_decode(s, idx=_w(s, 0).end())
> Module json.decoder:378 in raw_decode
>>>  raise ValueError("No JSON object could be decoded")
> ValueError: No JSON object could be decoded
> extra data

It would probably help diagnose your problem if you specified exactly
what code you were inserting data with and what that data looks like.
That's probably where the problem is.

I don't know the specifics of that riak client but you can look at
what's coming through if you run that under pdb.
http://docs.python.org/library/pdb.html

First start Python in interactive mode:
$ python -i yourscript.py

then when it prints the traceback and kicks you to the interactive
prompt you should load pdb in post-mortem mode:

>>> import pdb; pdb.pm()

>From there you can navigate up the stack (with the "up" command) and
print out response[1] (with "p response[1]") to see what it is. You
may want to look at the repr of response[1] to be sure it is what you
think it is.

-bob




More information about the riak-users mailing list