Skip to content
Advertisement

I can’t catch PageError exception from Wikipedia in discord.py

So, i’m making an Wikipedia cog for my discord.py bot and everything is ok if the commands are used as expected, but, if i type something wrong (like “rb!resumen sjsajsajsja”), an PageError exception appears and the code stops. I have tried so many things to catch the exception and send it to the channel or print it in the terminal, so that my bot can keep running but nothing works.

JavaScript

This is the exception:

JavaScript

Advertisement

Answer

I managed to “fix” this problem. The thing i was saying about that the error appears in VsCode and not in the terminal was because the terminal doesn’t debug the file, simply runs it. The thing i managed to do is to keep two Wikipedia API’s in the bot: Wikipedia for searching pages and Wikipedia-API for retrieving its information. So, yes, it’s not a solution but is the way i took for not having this error.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement