Full context:
I’m newbie at using Python. I use Manjaro Linux with KDevelop as my code editor. I know some basics of Python, and wanted to try to create a discord bot, so I’m following this tutorial. Right now, I’m at video #15. The code is public and can be found here, so I downloaded it to comment it with my notes. Sometimes I like to run it and modify some stuff to see that I’m really understanding what’s happening. Of course, I’m using my own IDs for token and guild.
Issue
I need to use from re import A
, but KDevelop is showing me a warning: ‘Declaration for “A” not found in specified module’. Re is a module for regular expression operations, and it’s quite basic.
If I execute it directly on the terminal (which is where I execute the code too) I get:
❯ python
Python 3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> print(re.A)
re.ASCII
So it does recognize the module.
It does not allow me to use /
commands (Discord says I’m not allowed to) and it can’t find the !ciao
command when I execute it.
ERROR - discord.ext.commands.bot : Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "ciao" is not found
2023-01-14 14:55:48 ERROR discord.ext.commands.bot Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "ciao" is not found
Discussion:
I’ve asked on Reddit and someone told me that it could be an issue with KDevelop, which doesn’t load the module correctly. I checked the whole app and couldn’t find anything about it (I could have missed it, though, I’m a human, after all). But even if, it doesn’t explain why the code isn’t working when I’m using the original code (with my IDs), but it does on the video.