[docs] Possible error

Georg Brandl georg at python.org
Sun Oct 6 11:25:12 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 04.07.2013 15:34, schrieb Blanca Mancilla:
> Hi, I'm going through the documentation and came across the following
> error:
> 
> in http://docs.python.org/2.7/tutorial/interpreter.html, in the Source
> Encoding Section, there is a program:
> 
> # -*- coding: iso-8859-15 -*-
> 
> currency = u"?" print ord(currency)
> 
> which presents a problem when running:
> 
> 
> Traceback (most recent call last):
> 
> File "encoding.py", line 6, in <module> print ord(currency) TypeError:
> ord() expected a character, but string of length 3 found
> 
> but if I change the encoding to UTF-8 it works:
> 
> 
> # -*- coding: UTF -*-
> 
> it give the desired results. Not sure if it is a real bug.

Hi Blanca,

the encoding declaration has to match the actual encoding of the source file.
It appears that your editor saves as UTF-8 by default.

I have clarified this now; it should be online soon.

cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.21 (GNU/Linux)

iEYEARECAAYFAlJRLHgACgkQN9GcIYhpnLB+kQCgkFTNXoT6bPxJrOiHRU5ZyPQB
11wAn3nUeUyxLyST5IIMenD6kNiZgAVd
=vVqT
-----END PGP SIGNATURE-----


More information about the docs mailing list