通过Python模块调用Freebase时,_URLFetchResult对象没有属性'body'

时间:2011-02-07 20:51:36

标签: python httprequest freebase

我一直在成功使用Freebase Python模块来读取数据,今天我开始测试将数据写入Freebase。

但我一直收到一个对我没有意义的错误:

在相同的代码范围内,我可以毫无错误地执行mqlread(查询)。

但是当我尝试时:

freebase.mqlwrite(query)

我收到如下错误:

File "/Users/willmerydith/repos/supermeeple-sk/admin.py", line 96, in post
   result = freebase.mqlwrite(query)
 File "/Users/willmerydith/repos/supermeeple-sk/freebase/api/session.py",
line 745, in mqlwrite
   form=dict(query=qstr))
 File "/Users/willmerydith/repos/supermeeple-sk/freebase/api/session.py",
line 442, in _httpreq_json
   resp, body = self._httpreq(*args, **kws)
 File "/Users/willmerydith/repos/supermeeple-sk/freebase/api/session.py",
line 428, in _httpreq
   return self._http_request(url, method, body, headers)
 File "/Users/willmerydith/repos/supermeeple-sk/freebase/api/httpclients.py",
line 88, in __call__
   self._raise_service_error(url, resp.status_code,
resp.headers['content-type'], resp.body)
AttributeError: '_URLFetchResult' object has no attribute 'body'

这是否意味着这些调用无法访问Freebase?要么 Freebase没有发回适当的结果?

1 个答案:

答案 0 :(得分:0)

事实证明这是Freebase-Python中的一个错误。我已经提交了错误并提供了解决方案:http://code.google.com/p/freebase-python/issues/detail?id=15