Closed rdlmda closed 1 year ago
having the same issue, experimented a bit and I think its related to verison 20.0 of python-telegram-bot beeing published 16 hours ago.
At least for me following downgrade fixed it:
pip3 install --force-reinstall -v "python-telegram-bot==13.5"
Thank you @mazwettler
I faced the same issue. The problem seems caused by MAX_MESSAGE_LENGTH
constant has been renamed to MAX_TEXT_LENGTH
inside MessageLimit class in python-telegram-bot.
It seems like the fix is to import MessageLimit class and then access the constant via MessageLimit.MAX_TEXT_LENGTH. A couple lines of code changes needed in order to accomplish this fix.
The workaround that's working for me is as following:
from telegram.constants import MessageLimit
.
.
.
if len(m) > MessageLimit.MAX_TEXT_LENGTH:
warn(markup(
f"Message longer than MAX_TEXT_LENGTH={MessageLimit.MAX_TEXT_LENGTH}, splitting into smaller messages.",
"red"))
ms = split_message(m, MessageLimit.MAX_TEXT_LENGTH)
@viper7882 create a PR with this code, maybe @rahiel could approve it to master
@rahiel Please review PR https://github.com/rahiel/telegram-send/pull/124.
Or at least specify a valid range of python-telegram-bot
versions.
https://github.com/rahiel/telegram-send/blob/34d7703754d441a6f4c4a7b5b3210759d36078e2/setup.py#L22
It should be, for example, >=13.0,<14.0
.
pip3 install --force-reinstall -v "python-telegram-bot==13.5"
thank you. 👍
This is fixed with the recently merged PR #124, a new release will be out shortly.
pip install --user --upgrade --force-reinstall telegram-send && telegram-send --configure
ImportError: cannot import name 'MAX_MESSAGE_LENGTH' from 'telegram.constants' (/home/user/.local/lib/python3.10/site-packages/telegram/constants.py)