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.


    Save to arbitrary iCloud Drive path in new Pythonista?

    Pythonista
    6
    17
    14570
    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.
    • omz
      omz last edited by omz

      @zrzka In my experience, naively writing files in the iCloud container mostly works fine, if you make sure that you're the only one writing (e.g. when you have a script that produces time-stamped files). In short, if you make sure that conflicts are unlikely to arise, you're probably fine, but no guarantees.

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

        @omz same here, but no one never knows. It's better for others to know that smth bad can happen.

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

          Hey,

          icloud_path="/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/"
          quotes_file_name="my_quotes.txt";
          #Sync to iCloud;
          copyfile(icloud_path+quotes_file_name, current_path+quotes_file_name);
          
          

          Example code works from Pythonista IDE, but script has no access from widget.
          Maybe someone can direct me to some source making it right ? Or not possible to do it ?

          Thanks

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

            @surg30n Sorry, I don't understand. Do you want to execute this little script from the iOS widget screen? If yes, how do tout want to start the process? Without ui, button...?

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

              @cvp no.. script a bit bigger. I write my own quotes to quote-file, separately. Script just gets random one and prints it. So it does it in a widget too as a console output (I added that script to widget).

              Just, if script tries get the random line from the quotes-file residing in icloud, it succeeds when I run it from IDE but fails when it runs in widget. ‘Access denied’. (BTW script in widget runs itself every time when i open widgets screen or when it on left side in IOS13 always-on).

              This small example here is just to show, how, f.e. Script copies quote-file from local storage to icloud. It works from IDE but fails when running in widget. Just gives out ‘access denied’ referring to icloud

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

                @surg30n I think that your script copies FROM iCloud, not TO iCloud, thus are you sure the file already exists in iCloud

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

                  @cvp yes. It copies as in example above.
                  File exists in cloud for sure.

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

                    @surg30n Sorry. You're right. Same error while trying to copy a file from Pythonista iCloud.
                    Not sure it has ever worked in a widget or if it is since iOS 13 and/or Pythonista beta.
                    You know that widget process is very limited.

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

                      @cvp Thanks for approvement. Thought, maybe there is some appropriate method to copy file from cloud, and simple copy is not allowed in widget from the security pose, but it seems not.

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

                        @surg30n I've tested, with the Pythonista beta, a Siri shortcut performing only this shutil.copyfile, and I get the same error.

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