Wednesday, November 27, 2013

SyntaxError: Non-ASCII character '\xe9' in file on line 22


Share at Facebook

The Error:

SyntaxError: Non-ASCII character '\xe9' in file test.py on line 22, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details


This is mainly occurred when you are trying to print the unicode text into the console. Basically the error itself has the solution. Browsing the link will show you what exactly have to be done.


Just writing the below code at the very first or the second line at the script. This will set the encoding of the console and will evade the error you are encountering.


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





No comments: