Hi!
When I I am trying to run the same bot.py code the following error is coming , saying AttributeError: ‘Update’ object has no attribute ‘send_message’
(myvenv) D:\Codinglocks-PythonForDataScience\15. Project 04- Telegram Bot\news_bot>python bot.py
2021-12-27 00:14:40,588 - apscheduler.scheduler - INFO - Scheduler started
2021-12-27 00:14:41,401 - main - INFO - Started polling
<telegram.ext.callbackcontext.CallbackContext object at 0x04C29830>
2021-12-27 00:15:57,811 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while handling the error.
Traceback (most recent call last):
File “D:\Codinglocks-PythonForDataScience\15. Project 04- Telegram Bot\news_bot\myvenv\lib\site-packages\telegram\ext\dispatcher.py”, line 555, in process_update
handler.handle_update(update, self, check, context)
File “D:\Codinglocks-PythonForDataScience\15. Project 04- Telegram Bot\news_bot\myvenv\lib\site-packages\telegram\ext\handler.py”, line 198, in handle_update
return self.callback(update, context)
File “bot.py”, line 11, in start
author=update.message.from_user
AttributeError: ‘CallbackContext’ object has no attribute ‘message’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “D:\Codinglocks-PythonForDataScience\15. Project 04- Telegram Bot\news_bot\myvenv\lib\site-packages\telegram\ext\dispatcher.py”, line 567, in process_update
self.dispatch_error(update, exc)
File “D:\Codinglocks-PythonForDataScience\15. Project 04- Telegram Bot\news_bot\myvenv\lib\site-packages\telegram\ext\dispatcher.py”, line 810, in dispatch_error
callback(update, context)
File “bot.py”, line 28, in error
bot.send_message(chat_id=update.message.chat_id,text=“Some error occurred!”)
AttributeError: ‘Update’ object has no attribute ‘send_message’