#Using search_directory

1 messages · Page 1 of 1 (latest)

floral sonnet
#

im having issues loading my cogs using this method.

for extensions in disnake.utils.search_directory("./src/vrole/cogs"):
    self.load_extensions(extensions)

error

Traceback (most recent call last):
  File "c:\Github\VanityRoles\src\vroles\bot\__init__.py", line 50, in setup
    self.load_extension(extensions)
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 469, in load_extension
    spec = importlib.util.find_spec(name)
  File "C:\Users\jmart\AppData\Local\Programs\Python\Python310\lib\importlib\util.py", line 94, in find_spec
    parent = __import__(parent_name, fromlist=['__path__'])
ModuleNotFoundError: No module named 'src'
forest hare
#
disnake.utils.search_directory("src/vrole/cogs")```
maybe
tidal wind
#

All packages must have __init__.py

forest hare
#

@floral sonnet please use /solved

#

</solved:1025480784188027021>