No such file or directory: '/tmp/PetImages/Cat//tmp/PetImages/Cat/8334.jpg'

I have been facing this error continuously. I have tried a lot but I don’t understand what is te problem. I used the jupyter notebook as well from GitHub and other I get the same error but the image is different.
In google collab : [Errno 2] No such file or directory: ‘/tmp/PetImages/Cat//tmp/PetImages/Cat/8334.jpg’

In jupyter: No such file or directory: ‘/tmp/PetImages/Cat//tmp/PetImages/Cat/0.jpg’

I am uploading a screenshot as well.

Can someone please help me with this?

looks to me like you have the directory path in the file_name variable, so when you concatenate SOURCE_DIR + file_name you get the path twice.

This was helpful. I didn’t notice it. thankyou very much.

1 Like

However, now it takes a lot of time to pass go through the Test your split_data function.

I guess this is what we have to do.
files =
for file_name in os.listdir(SOURCE_DIR):
file_path = SOURCE_DIR + file_name

if os.path.getsize(file_path) > 0:
  print(file_name + 'filename is zero length, so ignoring.')