I am writing a Telegram bot and using the TelegramBotAPI library.
But there was a problem. Get out an error
File “main.py”, line 61
markup = types.ReplyKeyboardMarkup (resize_keyboard = True *) *
TabError: inconsistent use of tabs and spaces in indentation.
Help please.
If that use Sublime Text
Part of the code that doesn’t work:
@ bot.callback_query_handler (func = lambda call: True)
def callback_inline (call):
try:
if call.message:
if call.data == 'children':
# Keyboard
markup = types.ReplyKeyboardMarkup (resize_keyboard = True)
item1 = types.KeyboardButton ("Test1")
item2 = types.KeyboardButton ("Test2")
markup.add (item1, item2)
bot.send_message (message.chat.id, "We will turn your child's fascination with the computer into useful skills for the future. Our teachers will shift children's attention from games to developing their own projects, introduce new technologies, develop innovative thinking and teamwork experience." format (
message.from_user, bot.get_me ()), parse_mode = 'html', reply_markup = markup)
elif call.data == 'adults':
bot.send_message (call.message.chat.id, 'This is a complex of knowledge, skills, skills that will never leave you without work. International diploma, certificates from Microsoft, Cisco, Autodesk, an accumulated portfolio. All this will allow our graduate to successfully find a job both large local companies and international corporations. ')
# Removing buttons
bot.edit_message_text (chat_id = call.message.chat.id, message_id = call.message.message_id, text = "There are two training programs. Please choose which one you want to know about",
reply_markup = None)
except Exception as e:
print (repr (e))
Answer 1, authority 100%
Well, here you are clearly missing tabs in the line before elif
:
message.from_user, bot.get_me ()), parse_mode = 'html', reply_markup = markup)
elif call.data == 'adults':
It should be like this:
message.from_user, bot.get_me ()), parse_mode = 'html', reply_markup = markup)
elif call.data == 'adults':