_URLFetchResult 对象没有属性“body”;通过 Python 模块调用 Freebase 时

发布于 2024-10-16 10:27:37 字数 1092 浏览 2 评论 0原文

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

但我不断收到一个对我来说没有意义的错误:

在相同的代码范围内,我可以执行 mqlread(query) 而不会出现错误。

但是当我尝试时:

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 没有发回正确的结果?

I've been using the Freebase Python module successfully to read data, and today I started testing writing data to Freebase.

But I keep getting an error that isn't making sense to me:

Within the same scope of code, I can perform an mqlread(query) without error.

But when I try:

freebase.mqlwrite(query)

I get an error like:

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'

Does this mean that those calls are failing to reach Freebase? Or
that Freebase is not sending back a proper Result?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太阳哥哥 2024-10-23 10:27:37

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

It turns out this is a bug in Freebase-Python. I've filed the bug and offered a solution: http://code.google.com/p/freebase-python/issues/detail?id=15

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文