AttributeError: 'dict' object has no attribute 'iteritems'
geduldig opened this issue · comments
geduldig commented
The following works in Python 2, but throws AttributeError in Python 3:
db = server[DBNAME]
doc = db[id]
This works in both Python 2 and Python 3:
doc = db.get(id)
Dirkjan Ochtman commented
Can you paste the full traceback, please? It looks like we do test for that, so I'm a bit puzzled.
Dirkjan Ochtman commented
Also, what version of couchdb-python are you working with here?
geduldig commented
Version 0.10.
Traceback (most recent call last):
File "/Users/jonas/Developer/test/db.py", line 43, in delete
self.db.delete(self.db[id])
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/client.py", line 338, in __getitem__
_, _, data = _doc_resource(self.resource, id).get_json()
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 555, in get_json
return self._request_json('GET', path, headers=headers, **params)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 578, in _request_json
headers=headers, **params)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 574, in _request
credentials=self.credentials)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 434, in request
self.cache.puTraceback (most recent call last):
File "/Users/jonas/Developer/test/db.py", line 43, in delete
self.db.delete(self.db[id])
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/client.py", line 338, in __getitem__
_, _, data = _doc_resource(self.resource, id).get_json()
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 555, in get_json
return self._request_json('GET', path, headers=headers, **params)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 578, in _request_json
headers=headers, **params)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 574, in _request
credentials=self.credentials)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 434, in request
self.cache.put(url, (status, resp.msg, data))
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 460, in put
self._clean()
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 466, in _clean
ls = sorted(self.by_url.iteritems(), key=cache_sort)
AttributeError: 'dict' object has no attribute 'iteritems'
t(url, (status, resp.msg, data))
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 460, in put
self._clean()
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/couchdb/http.py", line 466, in _clean
ls = sorted(self.by_url.iteritems(), key=cache_sort)
AttributeError: 'dict' object has no attribute 'iteritems'
Dirkjan Ochtman commented
This has been fixed already, in f539be6. I'll do a release soon to get this out to people.
geduldig commented
Thank you!
Dirkjan Ochtman commented
BTW, version 1.0 has been released.