Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileNotFoundError: [WinError 3] The system cannot find the path specified:

I'm trying to run the code from this tutorial. I have placed the code and dataset in the same directory, but still I get the following error.

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-6-5f5284db0527> in <module>()
     39 # extract features from all images
     40 directory = 'Flicker8k'
---> 41 features = extract_features(directory)
     42 print('Extracted Features: %d' % len(features))
     43 # save to file

<ipython-input-6-5f5284db0527> in extract_features(directory)
     18         # extract features from each photo
     19         features = dict()
---> 20         for name in listdir(directory):
     21                 # load an image from file
     22                 filename = directory + '/' + name

**FileNotFoundError: [WinError 3] The system cannot find the path specified: 'Flicker8k'**
like image 679
abbas khan Avatar asked Dec 18 '22 22:12

abbas khan


1 Answers

The system cannot find the path specified: 'Flicker8k'

It complains about not being able to find specified directory. Try to replace relative directory path directory = 'Flicker8k' with full absolute path to the Flicker8k directory (seems like you are on Windows so something that looks like C:\myproject\Flicker8k or if you are on linux /home/user/myproject/Flicker8k or wherever that dataset resides). So, make sure to:

  • use absolute path instead of realtive
  • folder (with correct capitalization) exists
  • dataset is actually there in said folder
  • access privileges to folder (and files within) are ok
like image 56
Const Avatar answered May 26 '23 02:05

Const