Twitter API を使い始めるために、簡単なメンション グラバーを作成しようとしています。ただし、API を初期化するときにいくつかの問題が発生しています。archlinux で python2 を実行する easy_install 経由で twitter をインストールし、ソースからビルドして pip 経由でインストールしました。これはどれも機能していないようです。
zergling :: ~/dev/kritter » python2
Python 2.7.2 (default, Jan 31 2012, 13:26:35)
[GCC 4.6.2 20120120 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import twitter
>>> api = twitter.Api()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Api'
ただし、twitter の pydoc はあります。何が間違っているのかわかりません。お役に立てれば幸いです
更新:twitter.api()
代わりに
使用してみtwitter.Api()
ましたが、次のエラーが発生しました: Traceback (most recent call last): File "main.py", line 8, in api = twitter.api() TypeError: 'module' object is not callable
追加情報:
>>> print dir(twitter)
['NoAuth', 'OAuth', 'Twitter', 'TwitterError', 'TwitterHTTPError', 'TwitterResponse', 'TwitterStream', 'UserPassAuth', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'api', 'auth', 'oauth', 'read_token_file', 'stream', 'twitter_globals', 'write_token_file']
>>> print twitter.__path__
['/usr/lib/python2.7/site-packages/twitter-1.7.2-py2.7.egg/twitter']