I was asking you to what the statement 'data' in os.listdir(PATH_TO_FOLDER)
evaluates to. This returned False.
Knowing this I can tell you, assert
works as intended. Assertions are Boolean expressions, depending on whether your statement 'data' in os.listdir(PATH_TO_FOLDER)
is True or False. If it is True, then nothing happens and your code skips to the next line. If False, it raises an AssertionError
. Assertions are meant to check if certain prerequisites are met.
Coming back to your issue: the error will stop from occuring if you make sure that your path is correct and you have a folder called data
there. Also note that os.listdir()
does not check for subfolders recursively.