I
I
igor2020-06-03 17:53:09
Telegram
igor, 2020-06-03 17:53:09

Bot in telegram, error when clicking, who can help?

2020-06-03 17:42:38,141 (util.py:66 WorkerThread2) ERROR - TeleBot: "AttributeError occurred, args=("type object 'Product' has no attribute 'id'",)
Traceback (most recent call last):
  File "C:\Users\DINEX\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 60, in run
    task(*args, **kwargs)
  File "C:/Users/DINEX/PycharmProjects/TELEGRAMbot/rec2020.py", line 1627, in callbackHandler
    bot.handleCallback(call)
  File "C:/Users/DINEX/PycharmProjects/TELEGRAMbot/rec2020.py", line 543, in handleCallback
    func(msg, self.__getBtnTextFromCallback(msg), self.__getBtnIdFromCallback(msg))
  File "C:/Users/DINEX/PycharmProjects/TELEGRAMbot/rec2020.py", line 664, in __handleCHOOSE_REGION
    self.__createOrder(userId)
  File "C:/Users/DINEX/PycharmProjects/TELEGRAMbot/rec2020.py", line 1295, in __createOrder
    self._Memories[userId].Product.id,
AttributeError: type object 'Product' has no attribute 'id'


I catch such an error when I press the inline buttons above the old ones, and specifically these are regions and products, in all other menu items there is no such error.

I have been scratching my head for two days now, and have not been able to fix this problem, so I ask for help in this problem.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-06-03
@hottabxp

The Product object does not have an id attribute)
As an option, wrap the problematic place in a try...except
Well, without code, it's hard to say.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question