paul-nameless / tg

terminal telegram client
The Unlicense
952 stars 74 forks source link

Hangs on start #269

Open marcoradocchia opened 2 years ago

marcoradocchia commented 2 years ago

After update to release v0.19.0 tg hangs on start and never opens.

marcoradocchia commented 2 years ago

Edit: works using libtd AUR package (https://aur.archlinux.org/packages/libtd), which provides TDLib v1.8.3 (commit: https://github.com/tdlib/td.git#commit=054a823c1a812ee3e038f702c6d8ba3e6974be9c) specifying manually TDLIB_PATH in config file.

jugendhacker commented 2 years ago

Edit: works using libtd AUR package (https://aur.archlinux.org/packages/libtd), which provides TDLib v1.8.3 (commit: https://github.com/tdlib/td.git#commit=054a823c1a812ee3e038f702c6d8ba3e6974be9c) specifying manually TDLIB_PATH in config file.

Hey, I'm the maintainer of the libtd AUR package and also telegram-tg, in theory this should also work without manually specifying TDLIB_PATH

marcoradocchia commented 2 years ago

Since the day I opened the issue I've been trying to figure out what was wrong. Initially it did hang on start, using the PyPi package installed via pip. Today I tried to reinstall, always via pip, but after reinstall I couldn't replicate the issue. However, without specifying TDLIB_PATH it says:

[ 0][t 4][1650814921.560891389][LogEvent.h:135][#1][!NetStatsManager][&version() < static_cast<int32>(Version::Next)]   Wrong version 36
zsh: segmentation fault (core dumped)  tg

I can confirm instead, that manually specifying TDLIB_PATH fixes the problem and tg runs as expected.

busch commented 2 years ago

Since the day I opened the issue I've been trying to figure out what was wrong. Initially it did hang on start, using the PyPi package installed via pip. Today I tried to reinstall, always via pip, but after reinstall I couldn't replicate the issue. However, without specifying TDLIB_PATH it says:

[ 0][t 4][1650814921.560891389][LogEvent.h:135][#1][!NetStatsManager][&version() < static_cast<int32>(Version::Next)] Wrong version 36
zsh: segmentation fault (core dumped)  tg

I can confirm instead, that manually specifying TDLIB_PATH fixes the problem and tg runs as expected.

Same issue here. Can you please share information on how and where to specify the TDLIB_PATH?

Best Regards, Michael

marcoradocchia commented 2 years ago

Since the day I opened the issue I've been trying to figure out what was wrong. Initially it did hang on start, using the PyPi package installed via pip. Today I tried to reinstall, always via pip, but after reinstall I couldn't replicate the issue. However, without specifying TDLIB_PATH it says:

[ 0][t 4][1650814921.560891389][LogEvent.h:135][#1][!NetStatsManager][&version() < static_cast<int32>(Version::Next)]   Wrong version 36
zsh: segmentation fault (core dumped)  tg

I can confirm instead, that manually specifying TDLIB_PATH fixes the problem and tg runs as expected.

Same issue here. Can you please share information on how and where to specify the TDLIB_PATH?

Best Regards, Michael

If you are on Arch, first of all install the libtd AUR package (should be v1.8.3-1). After that, append the following line to your tg configuration (at ~/.config/tg/config.py):

TDLIB_PATH = "/usr/lib/libtdjson.so"

This should fix the issue.

Let me know if this has been helpful in some way, Marco

busch commented 2 years ago

It seems like I got a different issue. Setting TDLIB_PATH did not solve the issue. I am on Debian and installed tg via

pip3 install tg

After launching tg, nothing happens (blank screen). From the error.log:

ERROR [2022-04-24 20:48:43,235] controllers.py:807 - draw | Error happened in draw loop
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/tg/controllers.py", line 805, in draw
    fun()
  File "/home/user/.local/lib/python3.9/site-packages/tg/controllers.py", line 825, in _render
    self._render_chats()
  File "/home/user/.local/lib/python3.9/site-packages/tg/controllers.py", line 842, in _render_chats
    self.view.chats.draw(selected_chat, chats, self.model.chats.title)
  File "/home/user/.local/lib/python3.9/site-packages/tg/views.py", line 216, in draw
    last_msg_sender, last_msg = self._get_last_msg_data(chat)
  File "/home/user/.local/lib/python3.9/site-packages/tg/views.py", line 249, in _get_last_msg_data
    user, last_msg = get_last_msg(chat, self.model.users)
  File "/home/user/.local/lib/python3.9/site-packages/tg/views.py", line 613, in get_last_msg
    last_msg["sender_id"].get("user_id"),
KeyError: 'sender_id'

Python version is 3.9.2.

Any ideas?

marcoradocchia commented 2 years ago

It seems like I got a different issue. Setting TDLIB_PATH did not solve the issue. I am on Debian and installed tg via

pip3 install tg

After launching tg, nothing happens (blank screen). From the error.log:

ERROR [2022-04-24 20:48:43,235] controllers.py:807 - draw | Error happened in draw loop
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/tg/controllers.py", line 805, in draw
    fun()
  File "/home/user/.local/lib/python3.9/site-packages/tg/controllers.py", line 825, in _render
    self._render_chats()
  File "/home/user/.local/lib/python3.9/site-packages/tg/controllers.py", line 842, in _render_chats
    self.view.chats.draw(selected_chat, chats, self.model.chats.title)
  File "/home/user/.local/lib/python3.9/site-packages/tg/views.py", line 216, in draw
    last_msg_sender, last_msg = self._get_last_msg_data(chat)
  File "/home/user/.local/lib/python3.9/site-packages/tg/views.py", line 249, in _get_last_msg_data
    user, last_msg = get_last_msg(chat, self.model.users)
  File "/home/user/.local/lib/python3.9/site-packages/tg/views.py", line 613, in get_last_msg
    last_msg["sender_id"].get("user_id"),
KeyError: 'sender_id'

Python version is 3.9.2.

Any ideas?

This looks exactly like the issue I had at first. The Traceback looks the same too. Before I tried to reinstall, in this scenario, I've been looking at the last commits and I tried to revert the changes in 7f9dd9b829c114662908aaf4ad8dfe8e40e32e6e, replacing every "sender_id" key with "sender" and got it working. Then, after reinstalling I got the error I reported above. I'm not entirely sure, but this seems all related to the TDLib version tg is trying to use. As I said, I did finally get it working with TDLib v1.8.3-1, manually specifying the TDLIB_PATH, setting it to the location of libtdjson.so on my system. Can you check what TDLib version is currently installed on your system?

busch commented 2 years ago

I can confirm that replacing every "sender_id" key with "sender" in TDLib fixed the issue!

Thanks!

stroobandt commented 2 years ago

I am experiencing the exact same blank screen issue when installing tg v0.19.0 from either PyPI or github source on my Ubuntu 20.04 server and trying to run it in mate-terminal over SSH.

Using the latest tdlib v1.8.9 did not resolve the issue. This caused another error about an API application key.

Hitting the Q key terminates the application properly.

kovmir commented 11 months ago

Same for me:

Traceback (most recent call last):
  File "/home/uninstance/.local/bin/tg", line 8, in <module>
    sys.exit(main())
  File "/home/uninstance/.local/lib/python3.9/site-packages/tg/__main__.py", line 69, in main
    tg.login()
  File "/home/uninstance/.local/lib/python3.9/site-packages/telegram/client.py", line 583, in login
    self.authorization_state = self._wait_authorization_result(result)
  File "/home/uninstance/.local/lib/python3.9/site-packages/telegram/client.py", line 513, in _wait_authorization_result
    result.wait(raise_exc=True)
  File "/home/uninstance/.local/lib/python3.9/site-packages/telegram/utils.py", line 45, in wait
    raise RuntimeError(f'Telegram error: {self.error_info}')
RuntimeError: Telegram error: {'@type': 'error', 'code': 400, 'message': 'Valid api_id must be provided. Can be obtained at https://my.telegram.org', '@extra': {'request_id': 'updateAuthorizationState'}}