-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Closed
Milestone
Description
Steps to reproduce
- Run code example below:
import logging
import os
import sys
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import (Updater, ConversationHandler, CallbackQueryHandler, CommandHandler)
from telegram.ext.dispatcher import run_async
def error(bot, update, err):
logging.warning('Update "%s" caused error "%s"' % (update, err))
def start(bot, update):
buttons = [[InlineKeyboardButton(text='Click me!', callback_data='Something')]]
bot.send_message(chat_id=update.message.chat.id,
text='Click the button below and look at log.',
reply_markup=InlineKeyboardMarkup(buttons))
# If you add a @run_async here the error changes to be on line 216 of ConversationHandler
def test(bot, update):
# Doesn't matter what's in this func
return ConversationHandler.END
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
token = os.getenv('TEST-TOKEN')
if not token:
logging.critical('NO TOKEN FOUND!')
sys.exit()
updater = Updater(token)
dp = updater.dispatcher
test_handler = ConversationHandler(
entry_points=[
CallbackQueryHandler(test)
],
states={},
fallbacks=[]
)
start_handler = CommandHandler('start', start)
dp.add_handler(test_handler)
dp.add_handler(start_handler)
dp.add_error_handler(error)
updater.start_polling()
updater.idle()- Send a
/startto bot - Click the
Click meinline button
Expected behaviour
No error in log.
Actual behaviour
A KeyError is shown in log (see logs below).
Note: It doesn't actually crash.
Configuration
Operating System:
Windows 10 Education
Version of Python, python-telegram-bot & dependencies:
$ python -m telegram
python-telegram-bot 5.0.0 (newest master branch)
urllib3 1.16
certifi 2016.08.02
future 0.15.2
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
Logs
https://gist.github.com/bomjacob/d9ae92f414a5c796eb86ac36b78b56d0