Forums

telegram_send module: ImportError

Getting this error when I try to import telegram_send to use my script:

import telegram_send   File "/home/rightlight/.local/lib/python3.8/site-packages/telegram_send/__init__.py",
  line 2, in <module>
from .telegram_send import configure, send   File "/home/rightlight/.local/lib/python3.8/site-packages/telegram_send/telegram_send.py",
line 32, in <module>
from telegram.constants import MAX_MESSAGE_LENGTH ImportError: cannot import name 'MAX_MESSAGE_LENGTH' from 'telegram.constants'
(/home/rightlight/.local/lib/python3.8/site-packages/telegram/constants.py)

I have read the ImportError debugging page and still not sure how to tackle this

That looks like you're trying to use a different version of the telegram module than the code was written for. Make sure that you know the version you need and that you are using it.

It works fine on my local machine with the current version though

Can you check the version you have on your local machine and the version you've installed on PythonAnywhere (in PA, you can do it by running pip3.8 show telegram in the Bash console).