【问题标题】:python twitter Api() not found errorpython twitter Api() 未找到错误
【发布时间】:2011-02-12 21:49:43
【问题描述】:

我正在尝试使用 python-twitter 模块,但在启动 twitter.Api() 时仍然遇到问题。我检查并重新检查了我的系统上没有其他名为 twitter.py 或 twitter.pyc 的文件。在全新安装时,我首先尝试

>>> import twitter 

并正确得到“模块未知”的响应

我做了一个easy_install twitter,成功了。

那就做吧

>>> import twitter
>>> testapi = twitter.Api()

回应是

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    testapi = twitter.Api()
AttributeError: 'module' object has no attribute 'Api'
>>> 

我已经筋疲力尽地试图在这里找到问题,请帮忙。

【问题讨论】:

  • 嗨 Perdo,欢迎来到 SO。以后,请使用{} 选项来格式化您的代码。
  • 另外,响应module unknown 不是成功响应。如果import 有效,您应该不会收到任何回复。 module unknown 表示它不工作。
  • @sukhbir:顶部的响应module unknown正确的。 OP 正在证明当时他的系统上没有 twitter 模块。

标签: python api twitter


【解决方案1】:

您似乎在尝试遵循一个 Python Twitter 模块的文档,而实际上您正在使用另一个 Python Twitter 模块。

您提到的Api() 方法调用是this Python Twitter module 的一部分。然而,当你使用easy_install twitter 时,你实际上得到了this other Python Twitter module

【讨论】:

    猜你喜欢
    • 2017-11-13
    • 1970-01-01
    • 2013-01-05
    • 1970-01-01
    • 2013-06-26
    • 1970-01-01
    • 2011-07-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多