2012-08-08 13 views
-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'] 

我希望你們這些人注意到這兩個東西在他們首先是在tweepy TweepError和第二個是在嘰嘰喳喳TwitterError。這兩個錯誤在我的應用程序中打擾了我。我安裝了很多次,但仍然面臨這兩個錯誤。我是Windows7用戶,使用Python2.6。 我得到這個錯誤可以ANY1幫我infrm這個

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 
+5

的閱讀文檔N0 1個C4N幫助ü2 infrm這個如果u不表明烏爾實際的錯誤。 – 2012-08-08 20:14:42

+3

請發表你的實際問題,與你想要做什麼,你看到的,而不是一起。沒有人能「幫助你解決這個問題」,因爲我們不知道這意味着什麼。此外,花時間使用完整的句子。使用縮寫詞和聊天說話是前人甚至讀你的問題的其餘部分得到downvoted的好方法。 – dimo414 2012-08-08 20:18:01

+0

@ dimo414好吧,我會等待。對不起 – 2012-08-08 20:21:30

回答

0

你只是與圖書館Twitter和python_twitter和tweepy.First閱讀您要使用,然後專注於庫,而不是尋找一些其他的文檔庫的文件混淆。這個錯誤是因爲你安裝了Twitter和python_twitter

+0

是的你的權利我有文件問題 – 2012-08-15 23:04:06

2

取代:

twitter = Twitter(format="xml") 

my_twitter = twitter.Twitter(format="xml") 

請注意,我也改變了本地創建的實例的名稱,以便您可以繼續使用twitter作爲模塊的名稱。

相關問題