Python is showing empty list when using os.listdir()

Viewed 39

This is the line of code:

names = os.listdir(SAVE_PATH + "/temp")

I tried to debug it and the names are an empty list [].

SAVE_PATH is imported from a different file and it is working properly

SAVE_PATH = r"C:\Users\rohit\Downloads\YouTube"

Files in that folder

Edit: This worked:

print(os.listdir(r"C:\Users\rohit\Downloads\YouTube\temp"))

code link Thanks

1 Answers

In between all those uncommented code I accidentally changed SAVE_PATH which caused this error.

I'm sorry for wasting your time guys.

Related