[PYTHON] [EC2] Error: Remedy for Non-ASCII character'\ xe8'

[EC2] Error: Remedy for Non-ASCII character'\ xe8'

Error when trying to run a python file on EC2 (while running selenium webdriver)

error contents

SyntaxError: Non-ASCII character '\xe8' 
in file filename.py on line line number, 
but no encoding declared; 
see http://python.org/dev/peps/pep-0263/ for details

An error that occurs when characters that cannot be read by default, such as Japanese, are used in the file. (It didn't happen locally, but it happened on EC2.)

approach

Describe the following on the first line of the file. (Declare that the character code is utf-8)

#-*- coding: utf-8 -*-

Execute it again and it is completed successfully.

Recommended Posts

[EC2] Error: Remedy for Non-ASCII character'\ xe8'
Today's python error: SyntaxError Non-ASCII character
When Python "Syntax Error: Non-ASCII character ~" appears
[Python] for statement error