License Public Domain
Lines 2
default (1) encoding (1) file (4) python (33) UTF-8 (1)
Owner: Stou S.
Viewable by Everyone
Editable by All Siafoo Users
Stay up to dateembedded code automagically updates, each snippet and article has a feed Join Siafoo Now or Learn More

Set Default Python File Encoding Atom Feed 1

In Brief Getting an error like this?... more
# 's
1import sys

Getting an error like this?

SyntaxError: Non-ASCII character 'xe2' in file /some/file on line 13, but no encoding declared; see for details

Set Python to always assume UTF-8 file encodings by saving this as '' in your site-packages directory.

If you're still getting an error, or want to set encodings per file, add this to the top of your file:

# 's
1# -*- coding: utf-8 -*-