Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"SyntaxError: Non-ASCII character" in running Python code

Im starting with python and when i use the interpreter and run this code:

>>>peliculas = ["movie1", "movie2", "movie3", "movie4"]
>>>print(peliculas[1])

when i use Pycharm IDE it doesnt compile:

peliculas = ["movie1", "movie2", "movie3", "movie4"]
print(peliculas[1])

This is the output:

 File "/Users/user/PycharmProjects/untitled/Prueba2.py", line 1
SyntaxError: Non-ASCII character '\xc3' in file /Users/user/PycharmProjects/untitled/Prueba2.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

What´s wrong with python?.. do i installed it correctly?

like image 370
anon Avatar asked Jul 25 '14 01:07

anon


1 Answers

Just add these two lines at to top of python code.

#!/usr/bin/env python
# -*- coding: utf-8 -*- 
like image 192
Rohit-Pandey Avatar answered Oct 30 '22 13:10

Rohit-Pandey