DeprecationWarning: Non-ASCII character '\xf3'
fredrik at pythonware.com
Tue Aug 23 20:34:24 CEST 2005
"jau" <jaumedominguez at airtel.net> wrote:
> print "hello world"
> i get this output
> hello world
> sys:1: DeprecationWarning: Non-ASCII character '\xf3' in file
> C:\Workspace\J&J\src\es\jau\main.py on line 2, but no encoding declared;
> see http://www.python.org/peps/pep-0263.html for details
> the article mentioned above didn't explain so much for me.
the error message means that Python found an \xF3-character
on the second line in your main program (\xF3 is usually "latin
small letter o with acute", or "ó")
the document you were referred to says
Python will default to ASCII as standard encoding if no other
encoding hints are given.
(in other words, Python wants you to use plain ASCII in your source
code, unless otherwise specified).
To define a source code encoding, a magic comment must
be placed into the source files either as first or second
line in the file:
# -*- coding: <encoding name> -*-
(in other words, if you want to keep using non-ASCII characters, you
need to add a line like
# -*- coding: iso-8859-1 -*-
and make sure it's the first or second line in your script. if you didn't
mean to add it, just get rid of it and try again. if eclipse doesn't
the character, check the file using notepad or some other editor)
More information about the Python-list