0

I am trying to access a dataset (and count the number of images) saved in my google drive through the following code in jupyter notebook, but I keep getting this error. I cannot use google colab for security reasons.The dataset has 17 folders and in every folder, there are more than 200 images so I cannot download it either.

code:

dataset='https://drive.google.com/drive/folders/16BXzy3nAGRJAH5j23Z38eG3npsSIqHEf?usp=sharing'

data_dir = pathlib.Path(dataset)

image_count = len(list(data_dir.glob('*/*.jpg')))

print(image_count)

error:

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'https:\\drive.google.com\\drive\\folders\\16BXzy3nAGRJAH5j23Z38eG3npsSIqHEf?usp=sharing'
Sergey Shubin
  • 3,040
  • 4
  • 24
  • 36

1 Answers1

0

Look like your are trying to connect remote location with os module. The error says that -

error: OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect:

Please try to connect Google Drive with google API code and call the operation with respective endpoint.

API Code: https://developers.google.com/drive/api/v3/quickstart/python

Endpoint list: https://developers.google.com/resources/api-libraries/documentation/drive/v3/python/latest/drive_v3.files.html