Nanoseb / ncTelegram

A ncurse Telegram client developed in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Random crashes when going through channels

15bitgames opened this issue · comments

commented

Sometimes going through the channel list it crashes with the following traceback.

Traceback (most recent call last):
  File "/usr/bin/nctelegram", line 70, in <module>
    ncTelegram.Telegram_ui(config_full)
  File "/usr/lib/python3.5/site-packages/ncTelegram/__init__.py", line 87, in __init__
    self.main_loop.run()
  File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 278, in run
    self._run()
  File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 376, in _run
    self.event_loop.run()
  File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 682, in run
    self._loop()
  File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 719, in _loop
    self._watch_files[fd]()
  File "/usr/lib/python3.5/site-packages/urwid/raw_display.py", line 393, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/usr/lib/python3.5/site-packages/urwid/raw_display.py", line 493, in parse_input
    callback(processed, processed_codes)
  File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 403, in _update
    self.process_input(keys)
  File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 509, in process_input
    something_handled |= bool(self.unhandled_input(k))
  File "/usr/lib/python3.5/site-packages/urwid/main_loop.py", line 555, in unhandled_input
    return self._unhandled_input(input)
  File "/usr/lib/python3.5/site-packages/ncTelegram/__init__.py", line 236, in unhandle_key
    self.chan_widget.go_prev_chan()
  File "/usr/lib/python3.5/site-packages/ncTelegram/ui_chanwidget.py", line 152, in go_prev_chan
    self.chan_change('bu', self.chans[self.current_chan_pos])
  File "/usr/lib/python3.5/site-packages/ncTelegram/ui_chanwidget.py", line 176, in chan_change
    self.Telegram_ui.msg_widget.get_history()
  File "/usr/lib/python3.5/site-packages/ncTelegram/ui_msgwidget.py", line 51, in get_history
    self.print_msg(msg)
  File "/usr/lib/python3.5/site-packages/ncTelegram/ui_msgwidget.py", line 146, in print_msg
    (urwid.AttrSpec(color_fwd, ''), msg['fwd_from']['first_name'] + '\n')] + text
KeyError: 'first_name'
commented

I also get this sometimes when logging into nctelegram after loading up telegram-cli. The error looks very similar to the above one.

bind: Address already in use
Traceback (most recent call last):
  File "/usr/bin/nctelegram", line 70, in <module>
    ncTelegram.Telegram_ui(config_full)
  File "/usr/lib/python3.5/site-packages/ncTelegram/__init__.py", line 69, in __init__
    self.msg_widget = MessageWidget(self)
  File "/usr/lib/python3.5/site-packages/ncTelegram/ui_msgwidget.py", line 23, in __init__
    self.get_history()
  File "/usr/lib/python3.5/site-packages/ncTelegram/ui_msgwidget.py", line 51, in get_history
    self.print_msg(msg)
  File "/usr/lib/python3.5/site-packages/ncTelegram/ui_msgwidget.py", line 146, in print_msg
    (urwid.AttrSpec(color_fwd, ''), msg['fwd_from']['first_name'] + '\n')] + text
KeyError: 'first_name'

This should be fixed now, because I have no way of testing it, please tell me if this error is still there.

PS: in your second backtrace the error bind: Address already in use is present, this means that telegram-cli was still running when nctelegram started, kill it before restarting nctelegram.

commented

Pulling from git now - I'll let you know shortly :)

commented

Your fix resolved the issue - thanks :)