1

I am making an image classifier. I have successfully created the folders and I manually placed the .txt files which has links to images from google inside each folder.

I am now trying to download the images from each .txt file either into a folder inside each folder category, or into each category folder that also has the .txt file, however i keep getting errors. please help.

I manually placed the .txt files in each of the folders as they was in the parent folder name as PLANTS but this has not made a difference.

I expected to get all the images downloaded in their respective folders from the .txt files with google image links but it is not working, whether the .txt is inside the main PLANTS FOLDER or inside each category folder which is inside the PLANTS folder

instead i get the below errors

FileNotFoundError

please see attached screen shot

enter image description here

&

enter image description here

Naveen Jain
  • 1,042
  • 7
  • 26
Darren Jay
  • 49
  • 4

1 Answers1

1

Long filenames or paths with spaces are supported by NTFS in Windows NT. However, these filenames or directory names require quotation marks around them when they are specified in a command prompt operation. Failure to use the quotation marks results in the error message.

 for i in range(len(folders)):
        path = "content/gdrive/My Drive/Colab Notebooks/Flowers/PLANTS"
        #for creating directory we need path class object so below this: 
        dest_for_creating_directory = path/folders[i]
        #for searchi directory which have spaces we need doubleQuotations that  
        #why user below one in download image function instead of dest. 
        dest_for_searching_directory = path+"/"+folders[i]

Note: its better practice to write folder/file name without space more info

Naveen Jain
  • 1,042
  • 7
  • 26
  • is your code written in python? the code is in python – Darren Jay Oct 01 '19 at 21:50
  • 1
    this is python yes. i have not declared variable name .. i just assigned the value . and for appending string we use concetenate operator in python. – Naveen Jain Oct 01 '19 at 21:53
  • can you write in the code in how you would want me to write it please. for i in range(len(folders)): path = Path('content/gdrive/My Drive/Colab Notebooks/Flowers/PLANTS') dest = path/folders[i] dest.mkdir(parents=True, exist_ok=True) links = Path(files[i]) download_images(links, dest, max_pics=200) – Darren Jay Oct 01 '19 at 22:20
  • @DarrenJay updated. check if it is working . is dest.mkdir(parents=True, exist_ok=True) is creating directory or not?? check that also – Naveen Jain Oct 01 '19 at 22:23
  • check that also and try to print dest variable show you can see what value dest has. – Naveen Jain Oct 01 '19 at 22:30
  • @DarrenJay i have explained again try this . i think you have not read the link i mentioned . if after this still you get error that remove spaces and use underscores in directory name. – Naveen Jain Oct 02 '19 at 10:47