Hide
Need a quick chart or graph for your blog? Try our reStructured Text renderer. Join Siafoo Now or Learn More

Set Default Python File Encoding

Revision 3 vs. Revision 4

Legend:

Unmodified
Added
Removed
  • Description

    r3 r4  
    11Getting an error like this?  
    22  
    33  SyntaxError: Non-ASCII character '\xe2' in file /some/file on line 13, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details  
    44  
    5 Set Python to always assume UTF-8 file encodings by saving this in your site-packages directory.  
     5Set Python to always assume UTF-8 file encodings by saving this as 'sitecustomize.py' in your site-packages directory.  
    66  
    77If you're still getting an error, or want to set encodings per file, add this to the top of your file:  
    88  
    99.. code:: python  
    1010