Crypto-Signal icon indicating copy to clipboard operation
Crypto-Signal copied to clipboard

telegram.utils of develop branche

Open qq020608 opened this issue 2 years ago • 8 comments

i can use the master branche , and i want to try some other features of the devekop branche , but i got always this error , and i have tried "pip install telegram" and "pip install python-telegram-bot" , it doesn't help , and even i del telegram in my config.yml , i got still this error , my system is ubuntu-22.04.2-desktop-amd64 , so what should i do ?

test@test-virtual-machine:~/crypto-signal$ sudo docker run --rm -ti -v $PWD/app:/app dev/crypto-signals:latest Traceback (most recent call last): File "app.py", line 17, in from notification import Notifier File "/app/notification.py", line 35, in from notifiers.telegram_client import TelegramNotifier File "/app/notifiers/telegram_client.py", line 8, in from telegram.utils.request import Request ModuleNotFoundError: No module named 'telegram.utils'

qq020608 avatar May 11 '23 22:05 qq020608

same problem

onradr avatar May 12 '23 22:05 onradr

@onradr @qq020608 temporal fix, set python-telegram-bot==13.13 in app/requirements-step-2.txt file.

laliux avatar May 24 '23 16:05 laliux

@onradr @qq020608 temporal fix, set python-telegram-bot==13.13 in app/requirements-step-2.txt file.

I have another error because of that:

app_1  | Traceback (most recent call last):
app_1  |   File "/app/app.py", line 17, in <module>
app_1  |     from notification import Notifier
app_1  |   File "/app/notification.py", line 27, in <module>
app_1  |     from telegram.error import TimedOut as TelegramTimedOut
app_1  |   File "/usr/local/lib/python3.12/site-packages/telegram/__init__.py", line 186, in <module>
app_1  |     from .bot import Bot
app_1  |   File "/usr/local/lib/python3.12/site-packages/telegram/bot.py", line 106, in <module>
app_1  |     from telegram.utils.request import Request
app_1  |   File "/usr/local/lib/python3.12/site-packages/telegram/utils/request.py", line 44, in <module>
app_1  |     import urllib3.contrib.appengine as appengine  # type: ignore[no-redef]
app_1  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app_1  | ModuleNotFoundError: No module named 'urllib3.contrib.appengine'

alkhachatryan avatar Feb 12 '24 00:02 alkhachatryan

All you need to do is to remove the second argument when creating a bot client. In init of TelegramNotifier just have this, instead of creation with Request argument:

self.bot = telegram.Bot(token=token)

And you can install the latest version of telegram client

alkhachatryan avatar Feb 12 '24 00:02 alkhachatryan

@alkhachatryan yes, by doing that change, the latest version of python-telegram-bot (e.g 20.8) can be installed.

But, v20.x is a breaking version because it is built on top of asyncio module, and a lot of changes in app are required. In my opinion, it's not worth it. That's why I'm gonna freeze with 13.x version.

laliux avatar Feb 19 '24 17:02 laliux

@laliux all required changes to telegram with asyncio ARE fixed in my repo: https://github.com/krypt0ra/station And now telegram notifier works like a charm.

alkhachatryan avatar Feb 22 '24 09:02 alkhachatryan