[Tutor] wierd error in comment string

Magnus Lyckå magnus at thinkware.se
Sun Apr 25 11:21:23 EDT 2004

At 13:42 2004-04-25 +0100, Dave S wrote:
>By a method of elimination it is the £ it does not like ....

Yes, that's the only non-ASCII character in your file.

>I have to tell python to use a character set which includes a £ ?

If you use IDLE, it will tell you what to do, and even fix the
file for you if you wish. Otherwaise, add something like

# -*- coding: cp1252 -*-


# -*- coding: iso8859_1 -*-

as the first or second line in the file.

(This is a new inconvenience from Python 2.3. I'm happy
to see it bite English speaking people as well! ;)

Magnus Lycka (It's really Lyckå), magnus at thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language 

More information about the Tutor mailing list