import logging
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
CallbackContext,
)
## MANY FUNCTIONS HERE....
def main() -> None:
"""Run the bot."""
# Create the Updater and pass it your bot's token.
updater = Updater(myToken)
# Get the dispatcher to register handlers
dispatcher = updater.dispatcher
# Add conversation handler with the states GENDER, PHOTO, LOCATION and BIO
conv_handler = ConversationHandler(
entry_points=[CommandHandler('start', start)],
states={
GENDER: [MessageHandler(Filters.regex('^(Boy|Girl|Other)$'), gender)],
PHOTO: [MessageHandler(Filters.photo, photo), CommandHandler('skip', skip_photo)],
LOCATION: [
MessageHandler(Filters.location, location),
CommandHandler('skip', skip_location),
],
BIO: [MessageHandler(Filters.text & ~Filters.command, bio)],
},
fallbacks=[CommandHandler('cancel', cancel)],
)
dispatcher.add_handler(conv_handler)
# Start the Bot
updater.start_polling()
# Run the bot until you press Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()
if __name__ == '__main__':
main()
It’s an basic example of python-telegrom-bot at gitHub. It runs on my computer with jupyter and pycharm ide… But when i try to run it on AWS i get this error ;
i try it with different versions of it but couldnt solve…:(
3
Answers
I also encountered the same abnormal problem
telegram-bot is used here
https://github.com/vicalloy/telegram-shell-bot
The python version is version 3.6.8 ,
The operating system is centos 7
enter image description here
I had the same problem but inside of docker container.
I just changed the version of python from
3.6
to3.7
and rebuild container. This fixed the issue for me.Hope this helps!
The latest versions of python-telegram-bot have problems with Python 3.6.
Instead of changing your python version, you can install an older version of python-telegram-bot.
pip install python-telegram-bot==13.7