I am new to Python and don't have experience of advanced techniques in Google Colab. I have been trying to write a Python code where I want to read a text file or MATLAB variable from my Google Drive. Then I would do analysis on that data. I followed the answer of this LINK to mount my drive. I am providing my code and screenshots below to elaborate.
My desired data files (.txt or .mat) are kept in folder named "Wave_Codes" in my Google Drive. I created a folder named "CodeTesting" inside the default folder "Colab Notebooks". There I saved the ipynb code.
from google.colab import drive
drive.mount('/content/drive', force_remount=True)
import sys
import os
path = os.path.abspath("/content/drive/MyDrive/Wave_Codes/")
sys.path.append(path)
After ruuning this code, the ouput shows that the monuting has been done. However, I notice that the File Browser (in Fig 1 below) is not showing the drive being mounted. If I hover my mouse pointer there, it still shows click to mount. Fig 1 This is why I am doubtful if the mount is even getting done at all. When I ran the code, it did ask me to verify my google log in and permission related stuff. I made sure that I did those right.
Next, if I move on to read my data from the file. It is showing error of "File Not Found" (Fig 2). Fig 2 Error
The only way I managed to read the file is when I put the entire path in the code. Fig 3
So, what is going wrong here? Is the mounting happening properly? Is it an issue of the path not getting set? How do I fix this?
I tried to reset everything, closed the browser, later I turned on the 'force mount' option. Nothing worked. It shows Mount is done, but the folder logo in file browser doesn't change and I keep getting the error while reading the file. I tried to read some simple text files instead of a .mat file, but it still gave me File Not Found error.
UPDATE:
After I ran the mounting and path setting code, I ran print(os.getcwd())
as suggested in comments. This revealed that the working directory is "content" (see Fig 4).
Fig 4: Working directory showing as 'content' even after mounting.
Does this mean the mount hasn't worked in the first place? Why is this happening? What am I doing wrong?