histrio/py-couchdb

json.encode(value), AttributeError: 'module' object has no attribute 'encode'

KodjoSuprem opened this issue · 2 comments

I want to get all design docs from a db:

for doc in db.all(startkey="_design/", endkey="_design0"):

and gets

File "...\pycouchdb\utils.py", line 116, in _encode_view_options
    value = json.encode(value)
AttributeError: 'module' object has no attribute 'encode'

I naively fixed it with the utils.to_json() function

I fixed this in #8, I didn't even know this issue existed but using json.JSONEncoder() is better (and the intended way) :-) json itself has no encode()

Now fixed in cb665f3
Thanks for report!