JDoe
JDoe

Reputation: 493

How to link google drive using google colab

I'm trying to read images to from google drive using google colab.Images are in folder AnomalyDetection/images

I'm trying to link the folder using following command

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

os.chdir("drive/My Drive/AnomalyDetection/images")
os.listdir()

But I'm getting error message

FileNotFoundError: [Errno 2] No such file or directory: 'drive/My Drive/AnomalyDetection/images'

Can you suggest me the correct way to connect the google drive

Upvotes: 1

Views: 802

Answers (1)

Kedar U Shet
Kedar U Shet

Reputation: 583

You need to add content first.

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

os.chdir("/content/drive/My Drive/AnomalyDetection/images")
os.listdir()

Upvotes: 3

Related Questions