I hope you will notice two thing in this. The first is the TweepError
in tweepy, and the second is the TwitterError
in Twitter. These two errors introduce errors in my application. I installed them many times, but am still facing these two errors. I am using Python 2.6 on Windows 7.
>>> import tweepy
>>> dir(tweepy)
['API', 'BasicAuthHandler', 'Cache', 'Cursor', 'DirectMessage', 'FileCache', 'Friendship', 'MemoryCache', 'ModelFactory', 'OAuthHandler', 'SavedSearch', 'SearchResult', 'Status', 'Stream', 'StreamListener', '***TweepError***', 'User', '__author__', '__builtins__', '__doc__', '__file__', '__license__', '__name__', '__package__', '__path__', '__version__', 'api', 'auth', 'binder', 'cache', 'cursor', 'debug', 'error', 'models', 'oauth', 'parsers', 'streaming', 'utils']
>>> import twitter
>>> dir(twitter)
['ACCESS_TOKEN_URL', 'AUTHORIZATION_URL', 'Api', 'CHARACTER_LIMIT', 'DEFAULT_CACHE', 'DirectMessage', 'Hashtag', 'List', 'REQUEST_TOKEN_URL', 'SIGNIN_URL', 'Status', 'StringIO', 'Trend', ***'TwitterError'***, 'Url', 'User', '_FileCache', '_FileCacheError', '__author__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__version__', 'base64', 'calendar', 'datetime', 'gzip', 'httplib', 'md5', 'oauth', 'os', 'parse_qs', 'parse_qsl', 'rfc822', 'simplejson', 'sys', 'tempfile', 'textwrap', 'time', 'urllib', 'urllib2', 'urlparse']
I get this error
twitter = Twitter(format="xml")
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
twitter = Twitter(format="xml")
NameError: name 'Twitter' is not defined
You are simply confused with libraries twitter and python_twitter and tweepy.First read the documentation of library which you want to use and then focus on that library instead looking some other documentation. This error is because you installed twitter and reading documentation of python_twitter