[Urwid] graph.py -- encoding error
Ian Ward
ian at excess.org
Sun Jul 23 19:32:17 EDT 2006
Rebecca Breu wrote:
> Hi.
>
> I just tested the example graph.py of the latest release.
>
> On one machine I get:
>
>
> Traceback (most recent call last):
> File "./graph.py", line 375, in ?
> main()
> File "./graph.py", line 372, in main
> GraphController().main()
> File "./graph.py", line 315, in __init__
> self.view = GraphView( self )
> File "./graph.py", line 129, in __init__
> urwid.WidgetWrap.__init__(self, self.main_window())
> File "./graph.py", line 295, in main_window
> vline = urwid.AttrWrap( urwid.SolidFill(u'\u2502'), 'line')
> File "./urwid/widget.py", line 91, in __init__
> c = Text(fill_char).render((1,))
> File "./urwid/widget.py", line 188, in render
> return apply_text_layout( text, attr, trans, maxcol )
> File "./urwid/canvas.py", line 353, in apply_text_layout
> tseg, cs = apply_target_encoding(
> File "./urwid/util.py", line 104, in apply_target_encoding
> s = s.encode( _target_encoding )
> UnicodeError: Latin-1 encoding error: ordinal not in range(256)
That's strange. Is util._use_dec_special set to False on your system?
It should be True, and that should cause \u2502 to map to '\x0fx\x0e' ..
which should have no problem being "encoded" in latin-1.
Would you change util.py line 104 to:
try:
s = s.encode( _target_encoding )
except UnicodeError:
assert 0, `_use_dec_special, s`
and post the output?
Ian
More information about the Urwid
mailing list