Nanoseb / ncTelegram

A ncurse Telegram client developed in Python
GNU General Public License v3.0
312 stars 26 forks source link

Crashes with AttributeError #15

Open nithinmurali opened 7 years ago

nithinmurali commented 7 years ago

Cant start nctelegram, i have installed all the dependencies

Traceback (most recent call last):
  File "/usr/local/bin/nctelegram", line 13, in <module>
    for connection in psutil.net_connections():
Nanoseb commented 7 years ago

Is that the complete backtrace? can you also give me some details on your installation

nithinmurali commented 7 years ago

Yes this is the complete backtrace i could see. distribution Ubuntu 14.04 i have python 2 and 3 installed along with anaconda i have also installed python3-urwid python3-psutil

Nanoseb commented 7 years ago

can you try the following code:

#!/usr/bin/env python3
import psutil
print(psutil.net_connections())

I have also noticed that mac os users need to be root to run that command, if it causes too much trouble I may try to find an other way to do that. As an hot fix you can also delete from lines 13 to 16 in the file: https://github.com/Nanoseb/ncTelegram/blob/master/nctelegram

nithinmurali commented 7 years ago

the above code also throws the same error


  File "./aa.py", line 3, in <module>
    print(psutil.net_connections())
AttributeError: 'module' object has no attribute 'net_connections'```
Nanoseb commented 7 years ago

ok, it seems that you are using an old version of psutils, can you try what is described here: http://stackoverflow.com/questions/30280767/unable-to-get-process-name-with-psutil

nithinmurali commented 7 years ago

okey , i have fixed it. maybe the readme should have pip3 install --upgrade psutil rather than sudo apt-get install python3-psutil

but now i have a new error. ( I tried running telegram-cli its working perfectly.)

Traceback (most recent call last):
  File "/usr/local/bin/nctelegram", line 79, in <module>
    ncTelegram.Telegram_ui(config_full)
  File "/usr/local/lib/python3.4/dist-packages/ncTelegram/__init__.py", line 87, in __init__
    self.main_loop.run()
  File "/usr/lib/python3/dist-packages/urwid/main_loop.py", line 272, in run
    self.screen.run_wrapper(self._run)
  File "/usr/lib/python3/dist-packages/urwid/raw_display.py", line 242, in run_wrapper
    return fn()
  File "/usr/lib/python3/dist-packages/urwid/main_loop.py", line 312, in _run
    self.draw_screen()
  File "/usr/lib/python3/dist-packages/urwid/main_loop.py", line 563, in draw_screen
    canvas = self._topmost_widget.render(self.screen_size, focus=True)
  File "/usr/lib/python3/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/container.py", line 2055, in render
    focus = focus and self.focus_position == i)
  File "/usr/lib/python3/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/listbox.py", line 473, in render
    focus_canvas = focus_widget.render((maxcol,), focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/widget.py", line 1750, in render
    canv = get_delegate(self).render(size, focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/decoration.py", line 225, in render
    canv = self._original_widget.render(size, focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/wimp.py", line 66, in render
    c = self.__super.render(size, focus)
  File "/usr/lib/python3/dist-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/usr/lib/python3/dist-packages/urwid/widget.py", line 1007, in render
    return apply_text_layout(text, attr, trans, maxcol)
  File "/usr/lib/python3/dist-packages/urwid/canvas.py", line 1291, in apply_text_layout
    text[s.offs:s.end])
  File "/usr/lib/python3/dist-packages/urwid/util.py", line 121, in apply_target_encoding
    s = s.encode( _target_encoding )
UnicodeEncodeError: 'latin-1' codec can't encode character '\u279c' in position 0: ordinal not in range(256)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python3.4/subprocess.py", line 960, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.4/subprocess.py", line 1602, in _communicate
    input_view = memoryview(self._input)
TypeError: memoryview: str object does not have the buffer interface
read: Connection reset by peer