SyntaxError: Non-ASCII character

A fairly typical error for those who use Cyrillic characters or any other characters outside ASCII.

File "args_demo.py", line 21 SyntaxError: Non-ASCII character '\xd0' in file args_demo.py on line 21, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

pep-0263

Perhaps the encoding problem can be solved by adding the required one to the beginning of the file

# coding=utf-8

Instead of utf-8, you can try cp1251, iso-8859-15 or another encoding that you suspect.

To change the file encoding in Windows you can open it in Notepad and save it (Save As → Encoding) in a different encoding

For changing the encoding in Linux you can read here

Article author: Andrei Olegovich