alot icon indicating copy to clipboard operation
alot copied to clipboard

Some values for displayed_headers trigger a crash upon opening a mail

Open lelutin opened this issue 9 years ago • 3 comments

I tried setting this:

displayed_headers="From,To,Cc,Bcc,Subject,X-Been-There,X-Loop"

In the hope of seeing mailing list information when it's available. But as it turns out, with this option set this way, when I open any mail I get a traceback with alot frozen on the error:

Traceback (most recent call last):
  File "/usr/bin/alot", line 20, in <module>
    main()
  File "/usr/share/alot/alot/init.py", line 186, in main
    UI(dbman, cmdstring)
  File "/usr/share/alot/alot/ui.py", line 87, in __init__
    self.mainloop.run()
  File "/usr/lib/python2.7/dist-packages/urwid/main_loop.py", line 274, in run
    self.screen.run_wrapper(self._run)
  File "/usr/lib/python2.7/dist-packages/urwid/raw_display.py", line 268, in run_wrapper
    return fn()
  File "/usr/lib/python2.7/dist-packages/urwid/main_loop.py", line 339, in _run
    self.event_loop.run()
  File "/usr/lib/python2.7/dist-packages/urwid/main_loop.py", line 1183, in wrapper
    rval = f(*args,**kargs)
  File "/usr/lib/python2.7/dist-packages/urwid/main_loop.py", line 1142, in _twisted_idle_callback
    callback()
  File "/usr/lib/python2.7/dist-packages/urwid/main_loop.py", line 551, in entering_idle
    self.draw_screen()
  File "/usr/lib/python2.7/dist-packages/urwid/main_loop.py", line 565, in draw_screen
    canvas = self._topmost_widget.render(self.screen_size, focus=True)
  File "/usr/lib/python2.7/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python2.7/dist-packages/urwid/decoration.py", line 225, in render
    canv = self._original_widget.render(size, focus=focus)
  File "/usr/lib/python2.7/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python2.7/dist-packages/urwid/container.py", line 1079, in render
    focus and self.focus_part == 'body')
  File "/usr/share/alot/alot/buffers.py", line 406, in render
    return self.body.render(size, focus)
  File "/usr/lib/python2.7/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python2.7/dist-packages/urwid/widget.py", line 1751, in render
    canv = get_delegate(self).render(size, focus=focus)
  File "/usr/lib/python2.7/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python2.7/dist-packages/urwid/listbox.py", line 457, in render
    (maxcol, maxrow), focus=focus)
  File "/usr/lib/python2.7/dist-packages/urwid/listbox.py", line 402, in calculate_visible
    next, pos = self.body.get_next( pos )
  File "/usr/share/alot/alot/foreign/urwidtrees/widgets.py", line 80, in get_next
    return self._get(self._tree.next_position(pos))
  File "/usr/share/alot/alot/foreign/urwidtrees/widgets.py", line 67, in _get
    res = self[pos], pos
  File "/usr/share/alot/alot/foreign/urwidtrees/lru_cache.py", line 102, in wrapper
    result = user_function(*args, **kwds)
  File "/usr/share/alot/alot/foreign/urwidtrees/widgets.py", line 53, in __getitem__
    entry = self._tree.get_decorated(pos)
  File "/usr/share/alot/alot/foreign/urwidtrees/nested.py", line 86, in get_decorated
    return self._get_decorated_entry(self._tree, pos)
  File "/usr/share/alot/alot/foreign/urwidtrees/nested.py", line 82, in _get_decorated_entry
    entry = tree.decorate(pos[0], entry, is_first=isf)
  File "/usr/share/alot/alot/foreign/urwidtrees/decoration.py", line 475, in decorate
    line = urwid.Columns(cols, box_columns=range(len(cols))[:-1])
  File "/usr/lib/python2.7/dist-packages/urwid/container.py", line 1761, in __init__
    if focus_column is None and w.selectable():
AttributeError: 'NoneType' object has no attribute 'selectable'

lelutin avatar Sep 14 '14 05:09 lelutin

This issue happens systematically when displaying the Date header in addition to the default ones:

displayed_headers = "From, To, Cc, Bcc, Subject, Date"

Versions:

  • alot: 0.8.1
  • urwid: 1.3.1
  • urwidtrees: 1.0.2

k0ral avatar Mar 31 '19 12:03 k0ral

Your log suggests that you're on python version 2.7, whereas alot >0.8 should be python 3 only. Do you get this error on py3 as well?

Just a hunch but it looks as if there is no check wether these headers are present and if not, the widget tree contains unexpected none values..

pazz avatar Apr 03 '19 20:04 pazz

Here is a stacktrace with python3:

Traceback (most recent call last):
  File "/nix/store/mxnq8qh6y4mgn95f0xslki5alrd92nwh-python3.7-alot-0.8.1/bin/.alot-wrapped", line 11, in <module>
    sys.exit(main())
  File "/nix/store/mxnq8qh6y4mgn95f0xslki5alrd92nwh-python3.7-alot-0.8.1/lib/python3.7/site-packages/alot/__main__.py", line 137, in main
    UI(dbman, cmdstring)
  File "/nix/store/mxnq8qh6y4mgn95f0xslki5alrd92nwh-python3.7-alot-0.8.1/lib/python3.7/site-packages/alot/ui.py", line 141, in __init__
    self.mainloop.run()
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/main_loop.py", line 278, in run
    self._run()
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/main_loop.py", line 376, in _run
    self.event_loop.run()
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/main_loop.py", line 1186, in run
    raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/main_loop.py", line 1200, in wrapper
    rval = f(*args,**kargs)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/main_loop.py", line 1159, in _twisted_idle_callback
    callback()
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/main_loop.py", line 564, in entering_idle
    self.draw_screen()
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/main_loop.py", line 578, in draw_screen
    canvas = self._topmost_widget.render(self.screen_size, focus=True)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/decoration.py", line 225, in render
    canv = self._original_widget.render(size, focus=focus)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/container.py", line 1083, in render
    focus and self.focus_part == 'body')
  File "/nix/store/mxnq8qh6y4mgn95f0xslki5alrd92nwh-python3.7-alot-0.8.1/lib/python3.7/site-packages/alot/buffers/thread.py", line 128, in render
    return self.body.render(size, focus)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/widget.py", line 1750, in render
    canv = get_delegate(self).render(size, focus=focus)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/listbox.py", line 455, in render
    (maxcol, maxrow), focus=focus)
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/listbox.py", line 400, in calculate_visible
    next, pos = self.body.get_next( pos )
  File "/nix/store/5d1hphg56j2rm3a74wchc8ngaqp7g508-python3.7-urwidtrees-1.0.2/lib/python3.7/site-packages/urwidtrees/widgets.py", line 82, in get_next
    return self._get(self._tree.next_position(pos))
  File "/nix/store/5d1hphg56j2rm3a74wchc8ngaqp7g508-python3.7-urwidtrees-1.0.2/lib/python3.7/site-packages/urwidtrees/widgets.py", line 68, in _get
    res = self[pos], pos
  File "/nix/store/5d1hphg56j2rm3a74wchc8ngaqp7g508-python3.7-urwidtrees-1.0.2/lib/python3.7/site-packages/urwidtrees/widgets.py", line 54, in __getitem__
    entry = self._tree.get_decorated(pos)
  File "/nix/store/5d1hphg56j2rm3a74wchc8ngaqp7g508-python3.7-urwidtrees-1.0.2/lib/python3.7/site-packages/urwidtrees/nested.py", line 88, in get_decorated
    return self._get_decorated_entry(self._tree, pos)
  File "/nix/store/5d1hphg56j2rm3a74wchc8ngaqp7g508-python3.7-urwidtrees-1.0.2/lib/python3.7/site-packages/urwidtrees/nested.py", line 84, in _get_decorated_entry
    entry = tree.decorate(pos[0], entry, is_first=isf)
  File "/nix/store/5d1hphg56j2rm3a74wchc8ngaqp7g508-python3.7-urwidtrees-1.0.2/lib/python3.7/site-packages/urwidtrees/decoration.py", line 475, in decorate
    line = urwid.Columns(cols, box_columns=range(len(cols))[:-1])
  File "/nix/store/7c7ykw5jr2574d5xcr4v35zzygg7i88g-python3.7-urwid-1.3.1/lib/python3.7/site-packages/urwid/container.py", line 1765, in __init__
    if focus_column is None and w.selectable():
AttributeError: 'NoneType' object has no attribute 'selectable'

k0ral avatar Apr 04 '19 15:04 k0ral