Title: Weird KeyError with ConversationHandler and CallbackQueryHandler · Issue #373 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: Weird KeyError with ConversationHandler and CallbackQueryHandler · Issue #373 · python-telegram-bot/python-telegram-bot
X Title: Weird KeyError with ConversationHandler and CallbackQueryHandler · Issue #373 · python-telegram-bot/python-telegram-bot
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) ...
Open Graph 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...
X 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...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/373
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Weird KeyError with ConversationHandler and CallbackQueryHandler","articleBody":"\u003c!--\nThanks for reporting issues of python-telegram-bot!\nTo make it easier for us to help you please enter detailed information below.\n\nPlease note, we only support the latest version of python-telegram-bot and\nmaster branch. Please make sure to upgrade & recreate the issue on the latest\nversion prior to opening an issue.\n-->\n### Steps to reproduce\n1. Run code example below:\n\n``` python\nimport logging\nimport os\nimport sys\n\nfrom telegram import InlineKeyboardButton, InlineKeyboardMarkup\nfrom telegram.ext import (Updater, ConversationHandler, CallbackQueryHandler, CommandHandler)\nfrom telegram.ext.dispatcher import run_async\n\n\ndef error(bot, update, err):\n logging.warning('Update \"%s\" caused error \"%s\"' % (update, err))\n\n\ndef start(bot, update):\n buttons = [[InlineKeyboardButton(text='Click me!', callback_data='Something')]]\n bot.send_message(chat_id=update.message.chat.id,\n text='Click the button below and look at log.',\n reply_markup=InlineKeyboardMarkup(buttons))\n\n\n# If you add a @run_async here the error changes to be on line 216 of ConversationHandler\ndef test(bot, update):\n # Doesn't matter what's in this func\n return ConversationHandler.END\n\n\nlogging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n\ntoken = os.getenv('TEST-TOKEN')\nif not token:\n logging.critical('NO TOKEN FOUND!')\n sys.exit()\n\nupdater = Updater(token)\n\ndp = updater.dispatcher\n\ntest_handler = ConversationHandler(\n entry_points=[\n CallbackQueryHandler(test)\n ],\n states={},\n fallbacks=[]\n)\n\nstart_handler = CommandHandler('start', start)\n\ndp.add_handler(test_handler)\ndp.add_handler(start_handler)\n\ndp.add_error_handler(error)\n\nupdater.start_polling()\n\nupdater.idle()\n```\n1. Send a `/start` to bot\n2. Click the `Click me` inline button\n### Expected behaviour\n\nNo error in log.\n### Actual behaviour\n\nA KeyError is shown in log (see logs below).\nNote: It doesn't actually crash.\n### Configuration\n\n**Operating System:**\nWindows 10 Education\n\n**Version of Python, python-telegram-bot & dependencies:**\n`$ python -m telegram`\npython-telegram-bot 5.0.0 (newest master branch)\nurllib3 1.16\ncertifi 2016.08.02\nfuture 0.15.2\nPython 3.5.2 |Continuum Analytics, Inc.| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]\n### Logs\n\nhttps://gist.github.com/bomjacob/d9ae92f414a5c796eb86ac36b78b56d0\n","author":{"url":"https://github.com/jsmnbom","@type":"Person","name":"jsmnbom"},"datePublished":"2016-08-10T09:38:27Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/373"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fe67fd25-92c1-6c1b-4711-194f9c8ff39b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B844:1D0DF9:373800:457534:6B029E4D |
| html-safe-nonce | f83ecc035475d15102395a5ecd3878e75a363891397b2dc247ee0ab1b18febf2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODQ0OjFEMERGOTozNzM4MDA6NDU3NTM0OjZCMDI5RTREIiwidmlzaXRvcl9pZCI6IjM0ODE1MDI1NzQ5OTIwNzIyNjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 68436f67d869e0603955053c39ae609e879f6c9811e725f11ec6bd9955e74740 |
| hovercard-subject-tag | issue:170374169 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-telegram-bot/python-telegram-bot/373/issue_layout |
| twitter:image | https://opengraph.githubassets.com/06b48c4e5e4f0573d504376f397937b37ba6cf8f2dcd9acbe1f760b6aea32c0e/python-telegram-bot/python-telegram-bot/issues/373 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/06b48c4e5e4f0573d504376f397937b37ba6cf8f2dcd9acbe1f760b6aea32c0e/python-telegram-bot/python-telegram-bot/issues/373 |
| og:image:alt | Steps to reproduce Run code example below: import logging import os import sys from telegram import InlineKeyboardButton, InlineKeyboardMarkup from telegram.ext import (Updater, ConversationHandler... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jsmnbom |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width