python twitter Api()未找到错误 [英] python twitter Api() not found error

查看:44
本文介绍了python twitter Api()未找到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<预><代码>>>>导入推特

并正确获得模块未知"的响应

我做了一个 easy_install twitter,成功.

然后做

<预><代码>>>>导入推特>>>testapi = twitter.Api()

回复是

回溯(最近一次调用最后一次):文件<pyshell#2>",第 1 行,在 <module> 中testapi = twitter.Api()AttributeError: 'module' 对象没有属性 'Api'>>>

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

解决方案

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

您提到的 Api() 方法调用是 this 的一部分Python Twitter 模块.但是,当您使用 easy_install twitter 时,您实际上获得了这个其他 Python Twitter 模块.

I'm trying to use the python-twitter module, but still having problems initiating the twitter.Api(). I've checked and rechecked that no other file named twitter.py or twitter.pyc is on my system. On a clean install i first try to

>>> import twitter 

and correctly get a response of 'module unknown'

I do a easy_install twitter, successfull.

Then do

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

The response is

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

I'm exhausted trying to locate the problem here, please help.

解决方案

It appears that you are trying to follow the documentation for one Python Twitter module when you are in fact using another Python Twitter module.

The Api() method call you mention is part of this Python Twitter module. However, when you use easy_install twitter, you actually get this other Python Twitter module.

这篇关于python twitter Api()未找到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆