toot icon indicating copy to clipboard operation
toot copied to clipboard

Toot TUI error "Attribute extends beyond text"

Open 7m0E7TRWiyc7eJlETAgDR-rp6HLJf2yvSnJLuQL opened this issue 1 year ago • 7 comments

toot v0.36.0 Universeodon Social Media universeodon.com running Mastodon 4.2.0

Traceback` (most recent call last):
  File "/usr/lib/python3.11/site-packages/urwid/font.py", line 243, in render
    canv = TextCanvas(byte_lines, None, character_set_lines, maxcol=width, check_width=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/canvas.py", line 402, in __init__
    raise CanvasError(f"Attribute extends beyond text \n{text[i]!r}\n{attr[i]!r}" )
urwid.canvas.CanvasError: Attribute extends beyond text 
b'  \xe2\x94\x82   '
[(None, 16)]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/toot", line 33, in <module>
    sys.exit(load_entry_point('toot==0.36.0', 'console_scripts', 'toot')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/toot/console.py", line 823, in main
    run_command(app, user, command_name, args)
  File "/usr/lib/python3.11/site-packages/toot/console.py", line 804, in run_command
    return fn(app, user, parsed_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/toot/commands.py", line 501, in tui
    TUI.create(app, user, args).run()
  File "/usr/lib/python3.11/site-packages/toot/tui/app.py", line 123, in run
    self.loop.run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 320, in run
    self._run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 423, in _run
    self.event_loop.run()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/asyncio_loop.py", line 191, in run
    raise exc.with_traceback(exc.__traceback__)
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/asyncio_loop.py", line 78, in wrapper
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 621, in entering_idle
    self.draw_screen()
  File "/usr/lib/python3.11/site-packages/urwid/event_loop/main_loop.py", line 635, in draw_screen
    canvas = self._topmost_widget.render(self.screen_size, focus=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget.py", line 149, in cached_render
    canv = fn(self, size, focus=focus)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/container.py", line 1567, in render
    body = self.body.render((maxcol, maxrow-ftrim-htrim),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget.py", line 149, in cached_render
    canv = fn(self, size, focus=focus)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/decoration.py", line 1029, in render
    canv = self._original_widget.render((maxcol,), focus)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget.py", line 149, in cached_render
    canv = fn(self, size, focus=focus)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/container.py", line 2147, in render
    canv = w.render((maxcol,), focus=focus and item_focus)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget.py", line 149, in cached_render
    canv = fn(self, size, focus=focus)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/decoration.py", line 725, in render
    canv = self._original_widget.render((), focus)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/widget.py", line 149, in cached_render
    canv = fn(self, size, focus=focus)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/graphics.py", line 102, in render
    c = self.font.render(ch)
        ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/font.py", line 245, in render
    raise CanvasError(
  File "/usr/lib/python3.11/site-packages/urwid/font.py", line 243, in render
    canv = TextCanvas(byte_lines, None, character_set_lines, maxcol=width, check_width=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urwid/canvas.py", line 402, in __init__
    raise CanvasError(f"Attribute extends beyond text \n{text[i]!r}\n{attr[i]!r}" )
urwid.canvas.CanvasError: Failed render of 'T' from line ['┌─┬─┐ ', '  │   ', '  │   ', '  │   ', '  ┴   ', '      ']:
Thin6x6Font():
  6
  [   '\n'
    "000000111111222222333333444444555555666666777777888888999999''\n"
    '┌───┐   ┐   ┌───┐ ┌───┐    ┐  ┌───  ┌───  ┌───┐ ┌───┐ ┌───┐ │\n'
    '│   │   │       │     │ ┌  │  │     │         │ │   │ │   │\n'
    '│ / │   │   ┌───┘    ─┤ └──┼─ └───┐ ├───┐     ┼ ├───┤ └───┤\n'
    '│   │   │   │         │    │      │ │   │     │ │   │     │\n'
    '└───┘   ┴   └───  └───┘    ┴   ───┘ └───┘     ┴ └───┘  ───┘\n'
    '\n',
    '\n'
    '!!   """######$$$$$$%%%%%%&&&&&&((()))******++++++\n'
    '│    ││  ┌ ┌  ┌─┼─┐ ┌┐  /  ┌─┐   / \\\n'
    '│       ─┼─┼─ │ │   └┘ /   │ │  │   │  \\ /    │\n'
    '│        │ │  └─┼─┐   /   ┌─\\┘  │   │ ──X── ──┼──\n'
    '│       ─┼─┼─   │ │  / ┌┐ │  \\, │   │  / \\    │\n'
    '.        ┘ ┘  └─┼─┘ /  └┘ └───\\  \\ /\n'
    '\n',
    '\n'
    ',,-----..//////::;;<<<<=====>>>>??????@@@@@@\n'
    '             /                  ┌───┐ ┌───┐\n'
    '            /  . .   / ──── \\       │ │┌──┤\n'
    '  ────     /        /        \\    ┌─┘ ││  │\n'
    '          /    . ,  \\  ────  /    │   │└──┘\n'
    ',      . /           \\      /     .   └───┘\n'
    '\n',
    '\n'
    '[[\\\\\\\\\\\\]]^^^____``{{||}}~~~~~~\n'
    '┌ \\     ┐ /\\     \\ ┌ │ ┐\n'
    '│  \\    │          │ │ │ ┌─┐\n'
    '│   \\   │          ┤ │ ├   └─┘\n'
    '│    \\  │          │ │ │\n'
    '└     \\ ┘    ────  └ │ ┘\n'
    '\n',
    '\n'
    'AAAAAABBBBBBCCCCCCDDDDDDEEEEEEFFFFFFGGGGGGHHHHHHIIJJJJJJ\n'
    '┌───┐ ┬───┐ ┌───┐ ┬───┐ ┬───┐ ┬───┐ ┌───┐ ┬   ┬ ┬     ┬\n'
    '│   │ │   │ │     │   │ │     │     │     │   │ │     │\n'
    '├───┤ ├───┤ │     │   │ ├──   ├──   │ ──┬ ├───┤ │     │\n'
    '│   │ │   │ │     │   │ │     │     │   │ │   │ │ ┬   │\n'
    '┴   ┴ ┴───┘ └───┘ ┴───┘ ┴───┘ ┴     └───┘ ┴   ┴ ┴ └───┘\n'
    '\n',
    '\n'
    'KKKKKKLLLLLLMMMMMMNNNNNNOOOOOOPPPPPPQQQQQQRRRRRRSSSSSS\n'
    '┬   ┬ ┬     ┌─┬─┐ ┬─┐ ┬ ┌───┐ ┬───┐ ┌───┐ ┬───┐ ┌───┐\n'
    '│ ┌─┘ │     │ │ │ │ │ │ │   │ │   │ │   │ │   │ │\n'
    '├─┴┐  │     │ │ │ │ │ │ │   │ ├───┘ │   │ ├─┬─┘ └───┐\n'
    '│  └┐ │     │   │ │ │ │ │   │ │     │  ┐│ │ └─┐     │\n'
    '┴   ┴ ┴───┘ ┴   ┴ ┴ └─┴ └───┘ ┴     └──┼┘ ┴   ┴ └───┘\n'
    '                                       └\n',
    '\n'
    'TTTTTTUUUUUUVVVVVVWWWWWWXXXXXXYYYYYYZZZZZZ\n'
    '┌─┬─┐ ┬   ┬ ┬   ┬ ┬   ┬ ┬   ┬ ┬   ┬ ┌───┐\n'
    '  │   │   │ │   │ │   │ └┐ ┌┘ │   │   ┌─┘\n'
    '  │   │   │ │   │ │ │ │  ├─┤  └─┬─┘  ┌┘\n'
    '  │   │   │ └┐ ┌┘ │ │ │ ┌┘ └┐   │   ┌┘\n'
    '  ┴   └───┘  └─┘  └─┴─┘ ┴   ┴   ┴   └───┘\n'
    '\n',
    '\n'
    'aaaaaabbbbbbccccccddddddeeeeeefffgggggghhhhhhiijjj\n'
    '                              ┌─┐\n'
    '      │               │       │        │     .  .\n'
    '┌───┐ ├───┐ ┌───┐ ┌───┤ ┌───┐ ┼  ┌───┐ ├───┐ ┐  ┐\n'
    '┌───┤ │   │ │     │   │ ├───┘ │  │   │ │   │ │  │\n'
    '└───┴ └───┘ └───┘ └───┘ └───┘ ┴  └───┤ ┴   ┴ ┴  │\n'
    '                                 └───┘         ─┘\n',
    '\n'
    'kkkkkkllmmmmmmnnnnnnooooooppppppqqqqqqrrrrrssssss\n'
    '\n'
    '│     │\n'
    '│ ┌─  │ ┬─┬─┐ ┬───┐ ┌───┐ ┌───┐ ┌───┐ ┬──┐ ┌───┐\n'
    '├─┴┐  │ │ │ │ │   │ │   │ │   │ │   │ │    └───┐\n'
    '┴  └─ └ ┴   ┴ ┴   ┴ └───┘ ├───┘ └───┤ ┴    └───┘\n'
    '                          │         │\n',
    '\n'
    'ttttuuuuuuvvvvvvwwwwwwxxxxxxyyyyyyzzzzzz\n'
    '\n'
    ' │\n'
    '─┼─ ┬   ┬ ┬   ┬ ┬   ┬ ─┐ ┌─ ┬   ┬ ────┬\n'
    ' │  │   │ └┐ ┌┘ │ │ │  ├─┤  │   │ ┌───┘\n'
    ' └─ └───┴  └─┘  └─┴─┘ ─┘ └─ └───┤ ┴────\n'
    '                            └───┘\n']
:Attribute extends beyond text 
b'  \xe2\x94\x82   '
[(None, 16)]

Sorry, left out the toot env information:

toot env
toot 0.36.0
Python 3.11.3 (main, Apr  5 2023, 15:52:25) [GCC 12.2.1 20230201]
Linux-6.3.1-arch1-1-x86_64-with-glibc2.37

Maybe related? https://github.com/urwid/urwid/issues/554

andresmrm avatar May 07 '23 06:05 andresmrm

Same error and env here.

itz-Jana avatar May 07 '23 10:05 itz-Jana

Maybe related? urwid/urwid#554

Definitely looks the same, so the issue is canvas. Darn.

Can confirm that python-urwid commit ffbfa07 fixes the issue:

https://github.com/urwid/urwid/commit/ffbfa07533809a523938d5e342ff7482a12dd5d0

Hi. I wondered whether someone knows any WA for the time being? Can this bug be fixed any time soon? If it's a question of spare hands, I can try and give some help.

Mrestof avatar Jun 18 '23 00:06 Mrestof

My work around was just to build python-urwid myself with the aforementioned fix. It isn't that large of a file so it didn't take long to compile.