couchdbkit
couchdbkit copied to clipboard
View are not view but string
emailcouchs = Email.view('email/all') print emailcouchs print emailcouchs.count()
so it give me this error :
<couchdbkit.client.ViewResults object at 0x1d68110>
Traceback (most recent call last):
File "saveemailpa.py", line 67, in
the latest with pip version with
and with your instruction :
Traceback (most recent call last):
File "/home/bussiere/saveemail/testcouchdb.py", line 13, in
Regards and thanks. Bussiere
do you have any simple test that could help me to reproduce? That could help a lot :)
I had a similar error in 0.6.4.
File "/usr/local/lib/python2.7/dist-packages/couchdbkit-0.6.4-py2.7.egg/couchdbkit/client.py", line 943, in iterator
self._fetch_if_needed()
File "/usr/local/lib/python2.7/dist-packages/couchdbkit-0.6.4-py2.7.egg/couchdbkit/client.py", line 1019, in _fetch_if_needed
self.fetch()
File "/usr/local/lib/python2.7/dist-packages/couchdbkit-0.6.4-py2.7.egg/couchdbkit/client.py", line 1002, in fetch
self._total_rows = self._result_cache.get('total_rows')
AttributeError: 'str' object has no attribute 'get'
When looking at the line of the exception, you see that
self._result_cacheis expected to be a dict- the value is set in the previous line
self._result_cache = self.fetch_raw().json_body
self._total_rows = self._result_cache.get('total_rows')
self._offset = self._result_cache.get('offset', 0)
So it looks like an invalid response was received from CouchDB. Maybe this should be checked in assigning _result_cache?
In the cases I observed, the response from CouchDB was actually invalid. In all cases, the response was like
{ "total_rows":625838,"offset":323983,"rows":[
{"id":"938aa209c352e00a4d841be90352c472","key":"somekey","value":null,"doc":{ thedoc }},
{ many more results }
without the closing ]}.
I could now track it down to https://issues.apache.org/jira/browse/COUCHDB-1769. Couch starts sending a view response, hits a duplicate and terminates the response. This produces the invalid JSON described above. So in my opinion this is a Couch bug, and not related to couchdbkit.