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.
Refresh /pull from icloud
-
Hi
I have 2 iPads - I’m sharing a text file in an iCloud folder that I’m writing to on one iPad and reading from on the other. Is there a way of pulling or updating a specific file in the iCloud folder structure with a command? -
@rb Assume that you have in iCloud Drive, a folder MyFolder containing a file MyFile.ext, you can access it in Pythonista as a normal file, if you open once the folder via open in External Files of the Pythonista files browser.
path = '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/MyFolder/MyFile.ext'
Write with
path = '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/MyFolder/MyFile.txt' with open(path,'wt') as fil: fil.write('content\n')
Read with
path = '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/MyFolder/MyFile.txt' with open(path,'rt') as fil: t = fil.read() print(t)
-
@cvp thanks for your reply - I’m already doing what you suggest ie I have this working such that when I run the program on the “reader” iPad it will read the file I have written to with the other iPad/program.
My issue is that it only does this once. Ie I run the reader and it works fine but if I change the file with the writer the reader is not updating the data. The reader is constantly checking the file (and I’ve tested this on the writer) but the actual file isn’t changing as I need to refresh/pull the file from iCloud.So what I’m after is a command that will update the iCloud folder or preferably just the file itself. -
@rb I'm sorry but I'm not sure that I correctly understand.
Anyway, it is sure that the update is not instantaneous. Thus, if you writer modifies the file, it has to be (aitomatically) uploaded to the cloud on the idevice where your writer runs. Then, some time later, the file would be (automatically) downloaded on the idevice where your reader runs, then when this reader will run, you should have the new content of your file. -
Hmm yeah it’s the “automatically” bit I want to manually run - ie force the file to update as quickly as possible.
-
@rb I've already remarked that when I try to open a file, it downloads Immediately but the upload is not always so quick, it is in a kind of uploads queue, so even if you could ask the download, not sure the last update is already in the cloud 😢
-
Seems to be working now I changed my reader device (old iPad mini) iCloud settings to passwords/accounts>push data ON an option not on my other iPad (iPad Pro) ...there’s a slight delay but it reads and updates ! Woop!
-
Interesting that you mention the push data setting... I too have been having issues having iCloud sync between devices. This wasn’t a problem before updating my iPad to iOS 13, that’s possibly not related, but it sure seems to be.
I have to manually force an update every time to get data in pythonista shared via the iCloud mechanism, it’s becoming a real PITA. (As discussed in this thread: https://forum.omz-software.com/topic/6091/icloud-syncing-and-pythonista )
I’m curious, you talk about the push data setting on an older iPad mini, I was wondering what iOS version? And would you be able to describe in great detail where that exact setting is? I’ve search in both devices and I’m not seeing anything that gives me that specifically. I’m guessing my iOS is probably newer than that iPad (my phone is iOS 12 and the iPad iOS 13).
-
@madivad even in iOS 13, you have this setting in the mails and accounts, at the bottom
-
-
@cvp yeah that’s it, from your previous post (before this one) I went looking and did find it...
Yeah, they are both set to push, I was kinda hopeful for a moment that was the problem, but it does not appear so... :(
-
Hi yes sorry just seen this - that’s indeed the setting but on the mini (iOS) it seems to not be restricted or specific to mail but I could be wrong.Also it could all be a coincidence I guess.
-
Cannot find this other than under mail, not on my ios13 both iphone and ipad. If have might solve the issue. Any hint how to find them.