I am on linux.

There is command line tool called "gdrive" that can handle google drive upload and download. It's github address is https://github.com/prasmussen/gdrive . But I got problem calling this program inside mathematica.

As the gdrive tutorial say, a first run of gdrive, you will meet this prompt

enter image description here

after verification, you don't need to verify it anymore, and in terminal

gdrive list

will show files on my google drive

admin@Precision:~/wc/gdrive$ ./gdrive list

Id Name
Type Size Created 1nyfgXauEC6JX1qeAMGtO85e_tIepx_Fg
39d465076ed1bdeaf4f...aab359f92a7c1c4.gz bin 12.8 MB 2018-11-07 14:53:53

Then I tried inside mathematica

RunProcess[{"./gdrive", "list"}, "StandardOutput"]

it outputs

Failed to list files: Get \ https://www.googleapis.com/drive/v3/files?alt=json&fields=\ nextPageToken%2Cfiles%28id%2Cname%2Cmd5Checksum%2CmimeType%2Csize%\ 2CcreatedTime%2Cparents%29&orderBy=&pageSize=30&q=trashed+%3D+false+\ and+%27me%27+in+owners: read tcp \> read: connection reset by peer

It just like the "gdrive" is not verified and being used for the first time!!! How to solve this issue?

PS. at the same time, python has no problem calling external gdrive

enter image description here

  • $\begingroup$ I have never used gdrive before, but I just installed it using the homebrew invocation from the Github page, and what you described immediately worked for me from within Mathematica with: RunProcess[{"gdrive", "list"}, ProcessDirectory -> "/usr/local/bin/"] (on macOS with M11.3) $\endgroup$ – ktm Nov 8 '18 at 1:48
  • $\begingroup$ In short, try pointing ProcessDirectory to the output of which gdrive $\endgroup$ – ktm Nov 8 '18 at 1:50
  • $\begingroup$ @user6014 hi, thank you for help. Did you connect to your google drive? What did got after running RunProcess. The github doesn't show a way of apt install. So I just download the executable directly $\endgroup$ – matheorem Nov 8 '18 at 5:37
  • $\begingroup$ Yes I connected to my Google Drive. Running RunProcess[{"gdrive", "list"}, ProcessDirectory -> "/usr/local/bin/"] listed the entirety of my Google Drive file directory. $\endgroup$ – ktm Nov 8 '18 at 16:29
  • $\begingroup$ @user6014 Thank you so much. Do you have spare time to try to use the compiled executable listed in download section instead of homebrew version? I somehow feel there is some difference. $\endgroup$ – matheorem Nov 13 '18 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.