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.
How to get a "text" file from iCloud Drive
-
If you want to get a "text" file (py,txt,...) from iCloud Drive to Pythonista via the ios File Picker, and if you have the Workflow app, you could:
- create once a Workflow, for instance GetFileFromIcloudDrive, containing only these two actions:
- Get Files
- Show Document Picker on
- Set Variable File (will contain the entire file)
- Get Details of file
- Get Name
- Set Variable FileName (will contain the file name)
- Get Variable File (neded for the next action)
- Get Details of file
- Get File Extension
- Set Variable FileExtension (will contain the file extension)
- Set Text
GetFileFromIcloudDrive:variable_FileName.variable_FileExtension
File - Copy to Clipboard
see Workflow
- Get Files
When you're "in" the File Picker, you can even get a file from another location, like Google Drive, OneDrive, etc...
- run this script
import webbrowser import clipboard import time # Get a text file from iCloud Drive via File Picker def get(): clipboard.set('') webbrowser.open('workflow://x-callback-url/run-workflow?name=GetFileFromIcloudDrive&x-success=pythonista://') text = clipboard.get() while text.find('GetFileFromIcloudDrive') < 0: text = clipboard.get() time.sleep(0.3) # Clipboard should be formatted as: # GetFileFromIcloudDrive:filename.ext\n # file_content i = text.find('\n') if i > 0: line1 = text[0:i] filename = line1[len('GetFileFromIcloudDrive:'):] print('/'+filename+'/') file = text[i+1:] locfil = open(filename,'w') locfil.write(file) locfil.close() get()
- create once a Workflow, for instance GetFileFromIcloudDrive, containing only these two actions:
-
good idea, did you post that scripts on github?
-
two possibilitie improvements:
- use (new) magic variables in workflow wFlow
- pass json object to pythonista
-
No sorry, nothing posted on Github
I don't use anymore Workflow, I only use Pythonista with which I can do all what I want, with a better ui.
You can import any file from anywhere in Pythonista.