Linked Questions

215 votes
23 answers
380k views

Python "SyntaxError: Non-ASCII character '\xe2' in file" [duplicate]

I am writing some python code and I am receiving the error message as in the title, from searching this has to do with the character set. Here is the line that causes the error hc = HealthCheck("...
KDecker's user avatar
  • 7,178
461 votes
2 answers
1.1m views

Working with UTF-8 encoding in Python source [duplicate]

Consider: $ cat bla.py u = unicode('d…') s = u.encode('utf-8') print s $ python bla.py File "bla.py", line 1 SyntaxError: Non-ASCII character '\xe2' in file bla.py on line 1, but no encoding ...
Nullpoet's user avatar
  • 11.3k
117 votes
1 answer
233k views

SyntaxError of Non-ASCII character [duplicate]

I am trying to parse xml which contains the some non ASCII cheracter, the code looks like below from lxml import etree from lxml import objectify content = u'<?xml version="1.0" encoding="utf-8"?...
OpenCurious's user avatar
  • 3,076
15 votes
2 answers
61k views

Declaring encoding in Python [duplicate]

I want to split a string in python using this code: means="a ، b ، c" lst=means.split("،") but I get this error message: SyntaxError: Non-ASCII character '\xd8' in file dict.py on line 2, but no ...
user1472850's user avatar
19 votes
1 answer
5k views

What's the difference between 'coding=utf8' and '-*- coding: utf-8 -*-'? [duplicate]

Is there any difference between using #coding=utf8 and # -*- coding: utf-8 -*- What about # encoding: utf-8
orome's user avatar
  • 49.1k
6 votes
1 answer
20k views

SyntaxError: Non-ASCII character but no encoding declared [duplicate]

I am suppose to change some of these characters in English to Chinese in this setting.py file but then error happened. I know that it's saying because no encoding is declared in the error message but ...
Dora's user avatar
  • 7,040
2 votes
6 answers
5k views

Special chars in Python [duplicate]

i have to use special chars in my python-application. For example: ƃ I have information like this: U+0183 LATIN SMALL LETTER B WITH TOPBAR General Character Properties In Unicode since: 1.1 Unicode ...
Max Frai's user avatar
  • 64.6k
3 votes
3 answers
26k views

SyntaxError: Non-UTF-8 code starting with '\x92' in file D:\AIAssistant\build\gui.py on line 92, but no encoding declared; [duplicate]

So I'm running a python GUI script, but it gives me the following error: SyntaxError: Non-UTF-8 code starting with '\x92' in file D:\AIAssistant\build\gui.py on line 92, but no encoding declared; see ...
JKR's user avatar
  • 99
7 votes
1 answer
28k views

SyntaxError: Non-UTF-8 code starting with '\x82' [duplicate]

I get this error in Eclipse while working on "Byte of Python" It says the error shows up in 2 lines: source = ["C:\\My Documents", "C:\\Code"] and zip_command = "zip -qr {0} {1}".format(target, ‚ ‚....
Elmer's user avatar
  • 398
4 votes
1 answer
24k views

Python SyntaxError: Non-UTF-8 [duplicate]

I converted my Python script to a Mac.app (via py2app). I try to run it and get the following error: SyntaxError: Non-UTF-8 code starting with '\xcf' in file py2app/dist/myapp.app/Contents/MacOS/...
DDiran's user avatar
  • 583
1 vote
1 answer
13k views

Why do I get a SyntaxError that says "Non-UTF-8 code starting with..."? [duplicate]

I have a script which uses open() to create multiple files. All files are created successfully and it seems that there are no problems, but when attempting to run res.py, it crashes displaying ...
Mirac7's user avatar
  • 1,656
4 votes
1 answer
2k views

Which file encodings are supported for Python 3 source files? [duplicate]

Before you go telling me to read PEP 0263, keep reading... I can't find any documentation that details which file encodings are supported for Python 3 source files. I've found hundreds (thousands?) ...
aldo's user avatar
  • 2,995
2 votes
1 answer
7k views

Non-UTF-8 code starting with '\xff' when when running setup.py [duplicate]

I'm following Python's Packaging Projects tutorial and when it tells to run python3 setup.py sdist bdist_wheel I receive the following error: PS C:\Users\username\dev\packaging_tutorial> python ...
Gammaliel's user avatar
0 votes
1 answer
8k views

How to fix "SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xc3 in position 0: invalid continuation byte" [duplicate]

I'm using visual studio code as my IDE for python. However, every time I want to print something in Mandarin, it keep showing me this error "SyntaxError: (unicode error) 'utf-8' codec can't decode ...
Jessie's user avatar
  • 1,305
3 votes
0 answers
7k views

SyntaxError: Non-ASCII character '\xc2' in file, but no encoding declared in Python 2.7 [duplicate]

I'm working on a sentiment analysis program, it was working properly on a windows (python 3.4) but when I switched to a mac os (python 2.7) it gave me this error when i ran it: SyntaxError: Non-...
Yasser Attia's user avatar

15 30 50 per page