我正在Python2.6中構建一個需要從CouchDb獲取數據的應用程序。我正在使用CouchDB-0.8-py2.6連接到數據庫。 我使用這個代碼:HttpLib2在嘗試向couchdb發出請求時拋出錯誤
import couchdb
server = couchdb.Server(url='http://localhost:5984/', full_commit=True, session=None)
db = server['databaseName']
doc = db['docId']
value = doc['value']
print(value)
在我的本地機器(OSX)的代碼運行完美,但是當我試圖Debian的服務器上運行它,我得到以下錯誤:
File "/usr/local/lib/python2.6/dist-packages/CouchDB-0.7dev_r199-py2.6.egg/couchdb/client.py", line 165, in __getitem__
db.resource.head() # actually make a request to the database
File "/usr/local/lib/python2.6/dist-packages/CouchDB-0.7dev_r199-py2.6.egg/couchdb/client.py", line 977, in head
return self._request('HEAD', path, headers=headers, **params)
File "/usr/local/lib/python2.6/dist-packages/CouchDB-0.7dev_r199-py2.6.egg/couchdb/client.py", line 1010, in _request
resp, data = _make_request()
File "/usr/local/lib/python2.6/dist-packages/CouchDB-0.7dev_r199-py2.6.egg/couchdb/client.py", line 1005, in _make_request
body=body, headers=headers)
File "/usr/local/lib/python2.6/dist-packages/httplib2-0.6.0-py2.6.egg/httplib2/__init__.py", line 1025, in request
cached_value = self.cache.get(cachekey)
AttributeError: 'bool' object has no attribute 'get'
我試過谷歌這無數次,似乎沒有人有同樣的錯誤。有沒有人知道我在這裏做錯了什麼?
哪行代碼導致此錯誤? – SilentGhost 2010-10-06 10:18:08
這一個:db = server ['databaseName'] – 2010-10-06 10:22:32
你在服務器/本地機器上使用哪個版本的Httplib和Python? – jsalonen 2010-10-06 10:34:10