Why when acessing the directory it's returning that it don't exist even if that directory exists

At my original code it was working fine, but now that i migrated it says that don’t exists? WTF?

I think it’s because you are trying to find /cogs, but it is actually located in /RP-Utilities-Beta/cogs. It’s because I believe that the ./ at the beginning makes it an absolute path, so it’s trying to find cogs in your root directory. So you could either change line 35 to

for filename in os.listdir("cogs")

or

for filename in os.listdir("./RP-Utilities-Beta")

Try both and see which works better.

2 Likes

Moved this topic from Code Help to Python and added the discord-bots tag

Same Error, with both

The directory exists, but it exists inside of another directory.

2 Likes

yep, that’s what i’m trying to do, but it seems not working

2 Likes

By the way, your folder is still misspelt.

Renaming it to the correct spelling will ensure you won’t encounter errors from tiny spelling mistakes

2 Likes

change line 35 to:

for filename in os.listdir("./RP-Utilitites/cogs"):
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.