Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telegram.utils of develop branche #472

Open
qq020608 opened this issue May 11, 2023 · 6 comments
Open

telegram.utils of develop branche #472

qq020608 opened this issue May 11, 2023 · 6 comments

Comments

@qq020608
Copy link

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'

@onradr
Copy link

onradr commented May 12, 2023

same problem

@laliux
Copy link
Collaborator

laliux commented May 24, 2023

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

@alkhachatryan
Copy link

@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
Copy link

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

@laliux
Copy link
Collaborator

laliux commented Feb 19, 2024

@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.

@alkhachatryan
Copy link

alkhachatryan commented Feb 22, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants