THE BOT IS REPLYING ONLY FRO SMALL TALKS CONVERSATIONS.
BUT NO REPLY WHEN FETCHING NEWS.
THIS ERROR IS BEING SHOWN IN TERMINAL
TypeError: error() takes 2 positional arguments but 3 were given
github url:
THE BOT IS REPLYING ONLY FRO SMALL TALKS CONVERSATIONS.
BUT NO REPLY WHEN FETCHING NEWS.
THIS ERROR IS BEING SHOWN IN TERMINAL
TypeError: error() takes 2 positional arguments but 3 were given
github url:
The actual error has occured from the API but because your error handler function
def error(bot,update):
logger.error("Update '%s' caused error '%s' ",update,update.error)
only accepts 2 arguments and the telegram bot library’s error handler method expects a callback function with 3 arguments as given here the actual error is not logged.
The solution is to convert your error handler function to:
def error(bot, update, telegramError):
logger.error("Update '%s' caused error '%s' %s",update,update.error, telegramError)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
THE ISSUE IS NOT RESOLVED YET.
THE SAME ISSUE PERSITS.
SMALL TALKS BOT IS REPLY BUT NOT WHEN ASKED TO FETCH NEWS.
IT IS GIVING THIS ERROR NOW AS GIVEN BELOW:-
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/Users/purunjaybhal/Desktop/Converse/personalvenv/lib/python3.7/site-packages/telegram/ext/dispatcher.py”, line 292, in process_update
self.dispatch_error(update, te)
File “/Users/purunjaybhal/Desktop/Converse/personalvenv/lib/python3.7/site-packages/telegram/ext/dispatcher.py”, line 384, in dispatch_error
callback(self.bot, update, error)
File “news_bot.py”, line 52, in error
logger.error(“Update ‘%s’ caused error ‘%s’ %s”,update,update.error, telegramError)
AttributeError: ‘Update’ object has no attribute ‘error’
Try to remove the update.error from logger
NO EFFECT.
STILL ONLY RESPONSE TO SMALL TALKS IS BEING EXECUTED.
I GOT IT RUNNING ,BUT STILL THE EXECUTION IS NOT PERFECT.
WHEN I ASK IT TO SHOW SPORTS NEWS, OR ANY SPECIFIC NEWS IT SHOWS ME THE GENERIC ONES OR THE NEWS NOT RELATED TO THAT TOPIC.GITHUB REPOSITORY HAS BEEN GIVEN ABOVE FOR CODE
how did you get it running i am still getting same error
hey @ambika54321 ,
just do one thing , create a new discussion for your doubt. So that we can easily help from there.
Thank You .