I'm trying to open a file from my Google Drive locally using a generic path name and without using the Google API to access the drive (the setup is difficult in my organisation).
I've tried to use path = '~/Google Drive/Shared drives/ as the generic path name, which works when reading in pandas dataframes using pd.read_csv(), but it does not work when I use open(path + filename, 'r') for other files. My understanding is that this is because if the path does not start with a / then it assumes you are looking for it locally.
I've also tried using abspath(expanduser("~/"), however this doesn't work either as my username is attached to the google drive folder as such /Users/first.last/CloudStorage/[email protected]/Shared drives/, and exapanding the ~ will only give me /Users/first.last/.
Is there anyway to expand ~/Google Drive/ into the full path name, or is there any other way to access this path generically?
Yes.
Use expanduser().
It sounds like what you really want may be