Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: How to solve SyntaxError: Non-ASCII character?

This is the unicode that I have defined at the top of my program

#!/usr/bin/env python
# -*- coding: utf-8 -*-

And yet I still get this error

SyntaxError: Non-ASCII character '\xfe' in file C:/Users/aaron/Desktop/Python/Bicycle_Diagnosis_System/Main.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

I have looked at the website it wprovides and trawled other websites and still can't find the answer. Any ideas (im using pycharm community edition as my IDE if that affects it)

Any help is much appreciated!

like image 942
Aaron Ramsey Avatar asked Sep 14 '25 15:09

Aaron Ramsey


1 Answers

Trying add #coding=utf-8 on line 1 and re-run

like image 116
Edwardyao Avatar answered Sep 16 '25 07:09

Edwardyao