I have uploaded a zip file in my Google Drive and I am trying unzip it and hence read the data by running command in Google Colab by mounting the disk. I am using the below command for unzipping.
f = gzip.open("drive/My Drive/Python files/mnist.pkl.gz", 'rb')
Whevever I try to view the data, it shows me an error that the file or directory does not exist but it is placed in this path only on the drive. Is that the case that we can not use the path here and just the file name? but then how do we unzip and then access the file present in the zip folder of my drive? Any help would be useful.
You can use ubuntu commands in colab environment to check what is your current directory:
Expected output should be
/content
.Then you can check whether google drive is mounted:
Output should list directories and files in current directory. Among others there should be folder "drive".
Explicitly you can check contents of mounted drive:
Output should be files and directories of your google drive. gz file "mnist.pkl.gz" should be listed as well.
When opening gz file you can use either absolute path
/content/drive/My Drive/Python files/mnist.pkl.gz
or relative pathdrive/My Drive/Python files/mnist.pkl.gz
or./drive/My Drive/Python files/mnist.pkl.gz
.