Ghosty
Ghosty

Reputation: 37

My colab won't let me import my dataset folder in drive

Code:

from google.colab import drive
import zipfile
drive.mount('/content/gdrive/')
DATA_PATH = '/content/gdrive/MyDrive/Colab Notebooks/'
import os
zf = zipfile.ZipFile(DATA_PATH+"PetImages", "r")
zf.extractall(DATA_PATH)

I am 100% sure the path is correct, but it gives me a IsADirectoryError. The folder is split in two mini-folders, cats and dogs.

Upvotes: 1

Views: 398

Answers (1)

Franz Diebold
Franz Diebold

Reputation: 640

Is /content/gdrive/MyDrive/Colab Notebooks/PetImages a ZIP file or is this the folder containing the ZIP file you want to extract?

The error message says that you are not passing a ZIP file but a folder.

So probably:

zf = zipfile.ZipFile(DATA_PATH + "PetImages/images.zip", "r")
zf.extractall(DATA_PATH)

Upvotes: 1

Related Questions