# problem with calling external “gdrive” command line tools

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

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

gdrive list


will show files on my google drive

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

SetDirectory["/home/admin/wc/gdrive"];
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 \ 172.16.24.201:35444->216.58.200.42:443: 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

• 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) – user6014 Nov 8 '18 at 1:48
• In short, try pointing ProcessDirectory to the output of which gdrive – user6014 Nov 8 '18 at 1:50
• @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 – matheorem Nov 8 '18 at 5:37
• Yes I connected to my Google Drive. Running RunProcess[{"gdrive", "list"}, ProcessDirectory -> "/usr/local/bin/"] listed the entirety of my Google Drive file directory. – user6014 Nov 8 '18 at 16:29
• @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. – matheorem Nov 13 '18 at 4:55