I'm working on my first program in python using cloud9 where I connect to twitter API and do sentiment analysis, but when I run the code I get this problem:
Your code is running at https://x-x.c9users.io.
Important: use os.getenv(PORT, 8080) as the port and os.getenv(IP, 0.0.0.0) as the host in your scripts!
File "/home/ubuntu/workspace/demo.py", line 23
SyntaxError: Non-ASCII character '\xd8' in file /home/ubuntu/workspace/demo.py on line 23, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
This is my code after I looked on a few solutions but I still get the same problem:
import os
import tweepy
from textblob import TextBlob
port = os.getenv('PORT', '8080')
host = os.getenv('IP', '0.0.0.0')
# Step 1 - Authenticate
consumer_key= 'xx'
consumer_secret= 'xx'
access_token='xx'
access_token_secret='xx'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
#Step 3 - Retrieve Tweets
public_tweets = api.search('school')
for tweet in public_tweets:
print(tweet.text)
analysis = TextBlob(tweet.text)
print(analysis.sentiment)
print("")
I also tried something called "Flask" but nothing changed. Thank you