C2W1_Unable to split data

what does the instruction tell in the grader cell first?
Use os.makedirs to create your directories with intermediate subdirectories
Don’t hardcode the paths. Use os.path.join to append the new directories to the root_path parameter

so first line code was correct for the main path.
after that, you created for training, validation, training/cats, validation/cats, training/dogs, validation/dogs.
But when you the subsequent codes for specific directory you forgot os.makedirs for all the other six files.
So for these six files, use os.make.dir and then se os.path.join with tuple, then root path with the six files(EXTRA HINT: DO NOT USE + RATHER WHEN WE APPEND ROOT PATH TO these six files you specify it with required file specific.

For example, if
my computer(local_drive) is my main directory, then next intermediate subdirectories would be
my computer(path.conjoint(local_drive, ‘specified file name’))

apply same logic to your code.

Once you clear this, let me know, we will move to the next grader cell.


He is already tagged :nerd_face:

Please start with explaining why there are 0 files in the training and testing directories based on this image.

Hi @balaji.ambresh ,
In training and validation file, there are two folders Cats & dogs generated.
But when I do split data, training from pet/images folder is not getting copied. I think this could be the issue.
Appreciate if you may please guide me on exact issue please if this is not the case…

Hi Om,

To troubleshoot a programming problem, I find it useful to have a simple case that I can examine quickly. Since this function is more of a Python programming exercise, I recommend these steps:

  1. Start a new blank notebook in https://colab.research.google.com/
  2. Copy that function there
  3. Create three directories in your workspace: a source directory, training directory, validation directory
  4. Upload 10 pictures to the source directory
  5. Have a unit test under that function. So you can just run it every time you modify something in the function.

This is what the initial setup will look like:

Once it’s behaving as expected in this setup. Look back at your assignment solution again and see if you’re applying the same logic. This looks rigorous but I think the experience you’ll get will help in troubleshooting other problems. This course is mainly aimed at developers so you will have to be comfortable with examining bugs in your code.

If you’re finding it difficult to make it work on a small example, I recommend brushing up on Python skills first so you’ll be better prepared for the rest of the course. You can search for particular techniques like “how to copy files to another directory” or paste your error messages so you’ll know what they mean.

Since you mentioned that you want to improve your Python skills, I recommend looking at this curated list by Raymond.

Hope these help.

1 Like

Hi @chris.favila
Thank you for your response, sure will go through the above…thanks again!