Error while creating directories

During the create_train_test_dirs function the directories got created are shown in the image attached.

while trying to split the data i am getting the following error
[Errno 2] No such file or directory: ‘/tmp/cats-v-dogs/training/cats/’

Did i not created the directories as expected ?
Why i don’t see the ‘/tmp/cats-v-dogs/training/cats’ instead why i am seeing ‘root_path’ as parent directory and not ‘cat-v-dogs’ ?

1 Like

Hi there,

It seems that the string ‘root_path’ is included in the directory name. However, in the implementation of the function create_train_val_dirs, it should use root_path as a string variable.
And as the hint indicated, you can use os.path.join(), here’s a link to the documentation.
E.G., if you want to create a path 'home/folder1/subfolder1/' you can do:

dir1 = 'home'
dir2 = 'folder1'
dir3 = 'subfolder1'
path = os.path.join(dir1,dir2,dir3)