omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Pythonista and Google Drive

    Pythonista
    google drive
    2
    14
    10744
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • shinyformica
      shinyformica last edited by

      So...I still don't understand it, but somehow only files which were created by Pythonista remain openable by Pythonista via Google Drive, unless I pass them through a third-party app like Documents.

      For example, if I create a .py file in Pythonista, edit it, then copy it to Google Drive by sharing it from within Pythonista, or if I create it in iCloud Drive in Pythonista, and then use Apple Files to copy it to Google Drive, in both cases Pythonista will be able to open, read and import it from Google Drive.

      However, if I just upload an identical .py file from somewhere else to Google Drive, Pythonista will show it greyed out in the file browser, and it won't be open/read/import-able. At least that's what I've discovered so far...I tried uploading a plain text file created with a tiny bit of boilerplate python in it:

      import os
      
      def test():
          print "hello"
      
      test()
      

      Saved it as "test.py". And then uploaded to Google Drive from three different OSes: Linux, Windows NT and Windows 10. All three were not openable by Pythonista, but an identical bit of boilerplate made in Pythonista and then copied to Google Drive as above still works. I even tried a round-trip: downloaded the working file from Google Drive to Windows 10, edited, saved, then uploaded it again, and it stopped being openable. I think Google Drive is mucking around with the file types and preventing Pythonista from seeing these files as plain text/.py files somehow. Would love to know if others experience similar results.

      cvp 2 Replies Last reply Reply Quote 0
      • cvp
        cvp @shinyformica last edited by

        @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

        1 Reply Last reply Reply Quote 0
        • cvp
          cvp @shinyformica last edited by cvp

          @shinyformica please read this
          Perhaps does Documents uses authorization "Drive" and Pythonista "Drive.file", that would explain the difference.

          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

          1 Reply Last reply Reply Quote 0
          • shinyformica
            shinyformica last edited by shinyformica

            @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.

            cvp 2 Replies Last reply Reply Quote 0
            • cvp
              cvp @shinyformica last edited by

              @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, ...

              1 Reply Last reply Reply Quote 0
              • cvp
                cvp @shinyformica last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • shinyformica
                  shinyformica last edited by

                  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?

                  cvp 3 Replies Last reply Reply Quote 0
                  • cvp
                    cvp @shinyformica last edited by cvp

                    @shinyformica strange, it comes from https://myaccount.google.com/permissions

                    Edit: perhaps due to the fact I use the Google API

                    1 Reply Last reply Reply Quote 0
                    • cvp
                      cvp @shinyformica last edited by cvp

                      @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
                      1 Reply Last reply Reply Quote 0
                      • cvp
                        cvp @shinyformica last edited by cvp

                        @shinyformica To use pydrive, the best is to read this topic

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Powered by NodeBB Forums | Contributors