No such file or directory: '/tmp/cats-v-dogs/training/cats/'

C2 Week 1


It seems that this error taking place oft and there are multiple posted solution. However none of these solutions works for me.

The blocks, Where is should write the code, are totally fine and there is no error with them but in the section of :


Test your split_data function

there is an error, which is “FileNotFoundError: [Errno 2] No such file or directory: '/tmp/cats-v-dogs/training/cats/”

I’m sure that the code that i have written is correct.

Can someone help me please?

Thank you in advance.


Please click my name and message your notebook as an attachment only if all the options below don’t apply:

  1. create_train_val_dirs is not implemented correctly.
  2. Cell containing create_train_val_dirs wasn’t run before the cell containing split_data.
  3. Colab environment was reset which would explain why the underlying structure got lost.

Thank you for your reply.

I just have sent you PM.

create_train_val_dirs should create the actual directories and not just the paths. Please use the appropriate function inside the os module to create the required directories.

There’s a hint in the notebook where the cell following the function create_train_val_dirs contains code to print the directory structure. Your execution results don’t match the expected directory structure.