IsADirectoryError in testing split_data function

Sorry if this seems redundant, but I cannot see the code others have referred to on this topic, so I need to start from scratch. My directory structure looks identical to the expected one:
/tmp/cats-v-dogs/validation
/tmp/cats-v-dogs/training
/tmp/cats-v-dogs/validation/cats
/tmp/cats-v-dogs/validation/dogs
/tmp/cats-v-dogs/training/cats
/tmp/cats-v-dogs/training/dogs

I am getting a IsADirectoryError when the split_data function is tested. (See screen shot)

:

Hello Gunnar,

The error states the directory path your created is incorrect. So go back to the first grader cell where it mentions you how to create the directory path. It also gives you hint about how to create the directory. I know you might have got a similar result as the expected one, but this grader cell are autograded, there can be many different ways to write code path for a directory but the grader is looking for to write code in a particular way which is not matching with the codes you have written.

Kindly refer the below post comment for guidance i.r.t. create and split data grader cell.

Let me know once your issue is resolved.

Regards
DP

I had done all of what you said (and no hard-coding of paths!), but I must have done something wrong. I’m starting from scratch. Now when I add anything (such as os.makedirs(‘training’) below os.makedirs(root_path), I receive the output “You should not be seeing this since the upper directory is removed beforehand”.

Gunnar please share the screenshot of the stated message you are mentioning.

I am seeing this error (IsADirectoryError: [Errno 21] Is a directory: ‘/tmp/PetImages/Cat/’) again, but feel my join and makedirs functions are as they should be now. Since I did not need to code the section of the program that created the ‘/tmp/PetImages/Cat/’ folder, (It was created even before the first part of the graded component) I don’t understand why it would relate to my code. Sorry to ask for help again!!

Shouldn’t cell #3 (not part of the code I am supposed to edit) apply the makedirs function after the code below:
source_path_dogs = os.path.join(source_path, ‘Dog’)
source_path_cats = os.path.join(source_path, ‘Cat’) ,
in order to avoid an IsA DirectoryErrot later on, which says there is no directory called ‘/tmp/PetImages/Cat’?

Gunnar,

You have created duplicate posts. Send me your notebook via personal DM. Click on my name and then message.

Regards
DP

Hello Gunnar,

that source path is showing you where and how files are created.

Read the below comment again, point by point. It is mentioned how to write both create direct path. and split data codes.

Regards
DP