[node-devel] a problem occured when switch the ovirt-node setup Page

Fabian Deutsch fabiand at redhat.com
Fri Jul 5 09:16:12 UTC 2013


Am Freitag, den 05.07.2013, 07:24 +0000 schrieb Bohai (ricky):
> Hi ALL,
> 
> When I switch between the ovirt-node setup Pages, the follow error ouccrred.
> About detail info, please see the follow trace.
> 
> I try to fix it like the follow code. It seems ok now.
> But I don't know whether the fix is proper.
> (For some reason, my network can't use ssh connect. 
> I will push it to "http://gerrit.ovirt.org/" a little later)

Hey Ricky,

I'll be happy to review your patch on gerrit! :)

> diff --git a/src/ovirt/node/setup/__main__.py b/src/ovirt/node/setup/__main__.py
> index 59eff4f..68973a9 100644
> --- a/src/ovirt/node/setup/__main__.py
> +++ b/src/ovirt/node/setup/__main__.py
> @@ -27,5 +27,8 @@ from ovirt.node import app, setup
> 
> 
>  if __name__ == '__main__':
> +    from urwid import set_encoding
> +    set_encoding('utf8')
> +
>      app = app.Application(setup)
>      app.run()

One thing that comes to my mind is moving this urwid specific lines into
the ui/urwid_builder.py file, which is urwid specific. All other files
should be rather agnostic to the "toolkit" used.

Greetings
fabian

> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/ovirt/node/app.py", line 303, in run
>     self.ui.run()
>   File "/usr/lib/python2.7/site-packages/ovirt/node/ui/urwid_builder.py", line 473, in run
>     self.__loop.run()
>   File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 271, in run
>     self.screen.run_wrapper(self._run)
>   File "/usr/lib64/python2.7/site-packages/urwid/raw_display.py", line 241, in run_wrapper
>     return fn()
>   File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 336, in _run
>     self.event_loop.run()
>   File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 707, in run
>     self._loop()
>   File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 777, in _loop
>     self._entering_idle()
>   File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 696, in _entering_idle
>     callback()
>   File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 548, in entering_idle
>     self.draw_screen()
>   File "/usr/lib64/python2.7/site-packages/urwid/main_loop.py", line 562, in draw_screen
>     canvas = self._topmost_widget.render(self.screen_size, focus=True)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 224, in render
>     canv = self._original_widget.render(size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1057, in render
>     focus and self.focus_part == 'body')
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1498, in render
>     canv = w.render((maxcol, rows), focus=focus and item_focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 2054, in render
>     focus = focus and self.focus_position == i)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1057, in render
>     focus and self.focus_part == 'body')
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 563, in render
>     canv = self._original_widget.render((maxcol,)+size[1:], focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1498, in render
>     canv = w.render((maxcol, rows), focus=focus and item_focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 1750, in render
>     canv = get_delegate(self).render(size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1498, in render
>     canv = w.render((maxcol, rows), focus=focus and item_focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 563, in render
>     canv = self._original_widget.render((maxcol,)+size[1:], focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1057, in render
>     focus and self.focus_part == 'body')
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 224, in render
>     canv = self._original_widget.render(size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1492, in render
>     canv = w.render((maxcol,), focus=focus and item_focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib/python2.7/site-packages/ovirt/node/ui/widgets.py", line 262, in render
>     rt = super(TableWidget, self).render(size, focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 1750, in render
>     canv = get_delegate(self).render(size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1492, in render
>     canv = w.render((maxcol,), focus=focus and item_focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1492, in render
>     canv = w.render((maxcol,), focus=focus and item_focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 402, in render
>     canv = self._original_widget.render((maxcol, self.height), focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 2054, in render
>     focus = focus and self.focus_position == i)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 813, in render
>     canv = self._original_widget.render((maxcol,), focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 563, in render
>     canv = self._original_widget.render((maxcol,)+size[1:], focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/decoration.py", line 224, in render
>     canv = self._original_widget.render(size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 140, in cached_render
>     canv = fn(self, size, focus=focus)
>   File "/usr/lib64/python2.7/site-packages/urwid/widget.py", line 1007, in render
>     return apply_text_layout(text, attr, trans, maxcol)
>   File "/usr/lib64/python2.7/site-packages/urwid/canvas.py", line 1290, in apply_text_layout
>     text[s.offs:s.end])
>   File "/usr/lib64/python2.7/site-packages/urwid/util.py", line 120, in apply_target_encoding
>     s = s.encode( _target_encoding )
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u25b2' in position 0: ordinal not in range(128)
> An error appeared in the UI: UnicodeEncodeError('ascii', u'\u25b2', 0, 1, 'ordinal not in range(128)')
> Press ENTER to logout ...
> or enter 's' to drop to shell
> 
> 
> Best regards to you.
> Ricky
> 
> _______________________________________________
> node-devel mailing list
> node-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/node-devel





More information about the node-devel mailing list