djc / couchdb-python

Python library for working with CouchDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'dict' object has no attribute 'iteritems'

geduldig opened this issue · comments

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)

Can you paste the full traceback, please? It looks like we do test for that, so I'm a bit puzzled.

Also, what version of couchdb-python are you working with here?

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'

This has been fixed already, in f539be6. I'll do a release soon to get this out to people.

Thank you!

BTW, version 1.0 has been released.