Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tweepy streaming error

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.

like image 437
Khal Drogo Avatar asked Jul 18 '26 22:07

Khal Drogo


1 Answers

"pip install tweepy" is still not currently functioning with python 3.7, roll back to 3.6.OB1 (and ignore the pip update recommendations).

should work then :)

like image 142
user9297883 Avatar answered Jul 25 '26 11:07

user9297883



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!