Pythonista and Google Drive
Is it possible to bring .py files over to pythonista from Google Drive? When I tap "Open..." under "External Files" in the main Pythonista panel, I get a Google Drive icon under the available locations, and I can navigate to and see files stored there...but only .txt files appear to be accessible, anything with .py or .zip is greyed out and can't be opened. I'm wondering if this is an iOS restriction, or a Google Drive restriction, or a Pythonista issue...just so I can determine if it's solvable at my end.
I see this thread about setting up PyDrive in pythonista to allow programmatic access to Google Drive, but that's more complicated than what I need, really...I just want to be able to transfer .py files to and from Pythonista3 via Google Drive, which seemed like it might be possible...
@shinyformica What I explained (share from Files App / Google Drive) was true but I agree that my files come from Pythonista via Google API upload.
Thus I didn't try with files coming from anywhere else
Edit: I think that Files app use "Drive.file" as authorization
Edit: I told you I use pydrive to upload/download to/from Google Drive. I've checked my authorization and it is "drive". I remember that two years ago I got this kind of problems to not be able to read files coming from other sources and that I have had to update my setting from "drive.file" to "drive". It seems your problem is something like that but I don't know where, sorry 😐
go here to check authorizations you gave to applications
@cvp thanks for those links, I think that's exactly what is going on. The Documents app definitely has "Drive" access, and I see no other apps authorized, which means it must be the default "iOS" authorization is "Drive.file" or lower. Which explains what I'm seeing.
I think I might just have to implement my own way of grabbing the files I need using pydrive, to avoid the two-step process via Documents.
I'll go find some good docs on pydrive and see how I would do it. What's your process for using pydrive to get files to and from Google Drive? I was hoping for a way to transfer an entire project directory structure back and forth, not individual files one by one.
@shinyformica I use pydrive for more than one year, without any problem.
The only difficulties I have had were to get access at beginning, solved due to big help of @jonb.
Your user, password and authorization scopes are stored in a settings file.
Once it's done, it is easy to use to, for instance, get a list of files in a folder, then download the files, etc...
You have methods like createfile, listfile, trash, upload, ...
@shinyformica You said "I see no other apps authorized"
Don't you see "My Drive" which is the Google Drive app?
If not, try first to install this app.
I definitely have the Google Drive app installed...without it, I wouldn't be able to see Google Drive in the locations when I hit "Open..." in Pythonista. But it is true that I am not seeing that exact interface you show above, anywhere...how do you get to that specific view of which apps are authorized? For me, neither the Settings->Manage Apps at drive.google.com, nor the app permissions details at myaccount.google.com/permissions show the same thing you see there. And none are showing the Drive app being given explicit permissions. So perhaps that is the issue?
Edit: perhaps due to the fact I use the Google API
@shinyformica in the Google Drive iOS app, you can get the same info
- left menu
- account at bottom
- manage your account (i translate from French)
- connection and security
- apps having access to your account