N
N
Nickie0002021-10-12 16:53:40
Python
Nickie000, 2021-10-12 16:53:40

What is the error ( module 'telebot.types' has no attribute 'ParseMode' )?

I decided to transfer the bot to different folders, so to speak, instead of one file. I didn’t change the code, I just moved it and an error occurred

An exception occurred: AttributeError (note: full exception trace is shown but execution is paused at: checkout_start)
module 'telebot.types' has no attribute 'ParseMode'
File "F:\puton\cds_assistant_bot\handlers \personal_actions.py", line 46, in checkout_start (Current frame)
parse_mode=types.ParseMode.HTML,
File "F:\puton\cds_assistant_bot\bot.py", line 6, in
executor.start_polling(dp, skip_updates=True )

here is my code: (parse_mode=types.ParseMode.HTML swears at this line)

async def checkout_start(message: types.Message, state: FSMContext):
    keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=1)
    buttons = ["Вернуться назад"]
    keyboard.add(*buttons)
    # Set state
    
    await Checkout.name.set()
    await message.reply(
        "Я начинаю собирать ваш заказ\n"
        "Для этого мне нужны Ваши данные\n"
        "Начнем пожалуй с <u>ФИО</u>,\n" 
        "впишите данные в следующем сообщении\n" 
        "Если вы случайно зашли в это меню нажмите (/cancel)", 
        parse_mode=types.ParseMode.HTML,
        reply_markup=keyboard
    )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ronald McDonald, 2021-10-12
@nickie000

You are accessing an attribute that does not exist. Read the right way: https://mastergroosha.github.io/telegram-tutorial-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question