I put my directories like this below:
path = '/home/renjith/datascience/kaggle/input/fastai2/data/'
dpath = '/home/renjith/datascience/kaggle/input/fastai2/lesson1/'
I would say do not get confused by "fnames.pkl". I am not sure exactly how that file was created. I guess its a pickle file,
However it is just a file with the filenames of your jepg images.
I created that file as below:
renjith@dlp20db:/lesson1/train$ find 'pwd' -name "*.JPEG" > ../fnames.pkl
There was carriage return at the line ending so I cleaned the file like below:
f = open(dpath +'fnames.pkl')
filenames = f.readlines()
fnames = [name.rstrip() for name in filenames]
Then I copied the first image and saved it to "dpath".
There might be better way to do this.
If this is not what you are looking for at which line do you get the error.