arush1836
arush1836

Reputation: 1547

Trouble loading data from Google Drive in Colaboratory

I am trying to load some data from google drive to my colab notebook, but I am getting an empty list.

Code:

from google.colab import drive
drive.mount('/content/drive')

import glob
import os

test_path = '/content/gdrive/My Drive/ML/data/cifar-100/test'

#path = os.path.join(test_path, 'class1', '*.jpg')
#path = os.path.join(test_path, 'class1', '*g')
path = os.path.join(test_path, 'class1', '*.*')

files = glob.glob(path)
len(files)

Output: 0

Data

enter image description here

enter image description here

Can anybody tell me why it’s not loading, everything seems to be fine

Upvotes: 4

Views: 887

Answers (1)

CodeIt
CodeIt

Reputation: 3628

You have mounted your drive to /content/drive but in your test path you are using /content/gdrive which will not work. You need to use /content/drive/My drive/...

test_path = '/content/drive/My Drive/ML/data/cifar-100/test'

See here for more info.

Hope it helps!

Upvotes: 2

Related Questions