I'm trying to analyze the sentiment of the tweets using tweepy and textblob. I did pip install tweepy and it was installed successfully, but I get the following error.
Error Message: File "C:\Users\joshey\Desktop\sent.py", line 2, in import tweepy File "C:\Users\joshey\AppData\Local\Programs\Python\Python37\lib\site-packages\tweepy__init__.py", line 17, in from tweepy.streaming import Stream, StreamListener File "C:\Users\joshey\AppData\Local\Programs\Python\Python37\lib\site-packages\tweepy\streaming.py", line 355 def _start(self, async):
import tweepy
from textblob import TextBlob
consumer_key= 'CONSUMER_KEY_HERE'
consumer_secret= 'CONSUMER_SECRET_HERE'
access_token='ACCESS_TOKEN_HERE'
access_token_secret='ACCESS_TOKEN_SECRET_HERE'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
public_tweets = api.search('Trump')
for tweet in public_tweets:
print(tweet.text)
analysis = TextBlob(tweet.text)
print(analysis.sentiment)
print("")
Is there any problem with the tweepy installation or the code? Can anyone help me figure out what's the problem? I tried googling, but nothing worked. Thanks in advance.
Is there any problem with the tweepy installation or the code? Can anyone help me figure out what's the problem? Thanks in advance.