0

I am tryin the code below using IMBD dataset. This is the code published in the book (deep-learning-with-python) and for some reason it keeps giving me the error "no such file or directory"

I don't know what i am doing wrong

enter code here
imdb_dir = 'C:/Users/st/Downloads/aclImdb'
train_dir = os.path.join(imdb_dir,'train')
labels = []
texts = []

for label_type in ['neg', 'pos']:
    dir_name = os.path.join(train_dir, label_type)
    for fname in os.listdir(dir_name):
        if fname[-4:] == '.txt':
            f = open(os.path.join(dir_name, fname))
            texts.append(f.read())
            f.close()
            if label_type == 'neg':
                labels.append(0)
            else:
                labels.append(1)
MadiE
  • 1
  • 1
    colab don't have access to your local storage, first, upload the dataset to colab and set the dataset path accordingly. – kiranr Apr 05 '21 at 17:16
  • Look at [this post](https://stackoverflow.com/questions/66878536/filenotfounderror-errno-2-no-such-file-or-directory-python-error/66878759#66878759), it explains your exact problem – SilentCloud Apr 06 '21 at 09:32

0 Answers0