When using restkit through couchdbkit, connecting to a server that isn't actually running couchdb produces a very confusing error message. For instance, this code
import couchdbkit
s = couchdbkit.Server('http://192.168.0.10:5984')
d = s['bar']
print list(d.all_docs())
gives this exception
Traceback (most recent call last):
File "foo.py", line 5, in <module>
print list(d.all_docs())
File "/home/cap/tmp/ve/lib/python2.6/site-packages/couchdbkit/client.py", line 956, in __len__
return self.count()
File "/home/cap/tmp/ve/lib/python2.6/site-packages/couchdbkit/client.py", line 890, in count
self._fetch_if_needed()
File "/home/cap/tmp/ve/lib/python2.6/site-packages/couchdbkit/client.py", line 921, in _fetch_if_needed
self.fetch()
File "/home/cap/tmp/ve/lib/python2.6/site-packages/couchdbkit/client.py", line 903, in fetch
self._result_cache = self.view._exec(**self.params).json_body
File "/home/cap/tmp/ve/lib/python2.6/site-packages/couchdbkit/client.py", line 991, in _exec
return self._db.res.get(self.view_path, **params)
File "/home/cap/tmp/ve/lib/python2.6/site-packages/restkit/resource.py", line 113, in get
params_dict=params_dict, **params)
File "/home/cap/tmp/ve/lib/python2.6/site-packages/couchdbkit/resource.py", line 108, in request
payload=payload, headers=headers, **params)
File "/home/cap/tmp/ve/lib/python2.6/site-packages/restkit/resource.py", line 189, in request
headers=self.make_headers(headers))
File "/home/cap/tmp/ve/lib/python2.6/site-packages/restkit/client.py", line 448, in request
return self.perform(request)
File "/home/cap/tmp/ve/lib/python2.6/site-packages/restkit/client.py", line 406, in perform
raise RequestError("socker.error: %s" % str(e))
restkit.errors.RequestError: socker.error: getaddrinfo returns an empty list
even though getaddrinfo returns correctly and the real problem is that the connection is refused.
When using restkit through couchdbkit, connecting to a server that isn't actually running couchdb produces a very confusing error message. For instance, this code
gives this exception
even though getaddrinfo returns correctly and the real problem is that the connection is refused.