Python utf-8 encoding error

Asked

Viewed 2,333 times

0

Good afternoon to all I am beginner to Python programming, I am creating a program that reads the information of a text and transcribes elsewhere.

Apparently the text was working normally on the computer, I uploaded all this information on github, when I generated this file on a new computer the following error occurred:

'utf-8' codec can’t Decode byte 0xea in position 1: invalid continuation byte.

I tried to add the some new parameters:

file = open(r'Query.txt','r',encoding='utf-8')

Yet without success.

Can someone help me?

1 answer

3


maybe because your "Query.txt" file is not in utf-8?? Try replacing "encoding" with "latin-1" instead of "utf-8":

file = open(r'Query.txt','r',encoding='latin-1')
  • Thank you very much, it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.