I'm following a sentiment analysis tutorial in which he provided the files to use. These are simple .txt files and when he runs the same code it works fine. But when I run it I get the below error.
with open("positive.txt","r") as f:
for line in f.read().split('\n'):
analysis = TextBlob(line)
if analysis.sentiment.polarity > 0:
pos_correct += 1
pos_count +=1
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 4645: invalid continuation byte
How can we have the same code and same file but I get this error and he does not?
Here is a link to the file if this helps. https://pythonprogramming.net/static/downloads/short_reviews/
Update to my question. I was trying this on my Mac when I ran into the issue. Tried it on my Windows PC and it works fine. Any ideas what the difference would be? Did everything the same.