1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【EC2】エラー:Non-ASCII character '\xe8'の対処法

Last updated at Posted at 2020-05-26

#【EC2】エラー:Non-ASCII character '\xe8'の対処法

EC2でpythonのファイルを実行しようとしたときに発生したエラー(seleniumのwebdriverを実行する途中)

##エラー内容

SyntaxError: Non-ASCII character '\xe8' 
in file ファイル名.py on line 行番号, 
but no encoding declared; 
see http://python.org/dev/peps/pep-0263/ for details

ファイル内に日本語など、デフォルトで読み込めない文字が使われている場合に発生するエラー。
(ローカルでは発生しなかったが、EC2上で発生。)

##対処法
ファイルの1行目に下記を記述。(文字コードがutf-8であることを宣言)

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

再度実行し、無事完了。
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?