Ordinal not in range(128)

Erik Max Francis max at alcyone.com
Sat Mar 1 19:38:11 EST 2003


Fabien HENON wrote:

> I have written a POV-RAY editor for Linux using Python and Tkinter.
> It mostly uses the text widget of Tkinter.
> 
> You can find it at :
> http://pyvon.sourceforge.net
> 
> As you can add comments in POV-RAY scripts, people who are using
> extended character (é,à,...) get the following message :
> 
> UnicodeError: ASCII encoding error: ordinal not in range(128)

This is a FAQ.  All it means that the Unicode object you're trying to
use as a normal string has not 7-bit clean, and so it can't know what
encoding you want to use without you giving it more information.  Try

	S = U.encode('latin-1')

or something similar (provided the character set you want really is
Latin-1).

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ There's this perfect girl / Living inside the shell
\__/ Lamya
    Fauxident / http://www.alcyone.com/pyos/fauxident/
 A "faux" ident daemon in Python.




More information about the Python-list mailing list