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.
Accessing files in IOS Files App
-
I am having trouble accessing files located in the IOS Files app. I have read many of the threads but must be missing something.
Example:
I went to the External Files section and added the top level folder that contained both a txt file, images and videos.
The top level folder is called ‘myFiles’.
Once added I assumed I would be able to open the file ‘email.txt’ as one of the following:
fh = open(‘email.txt’). Ie. It would used myFiles directory as part of a search path. Or
fh = open(‘myFiles/email.txt’) and also tried fh = open(‘/myFiles/email.txt’)
Thanks,
Chad -
I think this depends a bit on from where you are starting your script now.
The external folder is not equal to the site-packages folders that are automatically in your system path. And I figured out that e.g. running a file for doctest purposes and compared to the standard results is totally different path structures. External folders might be outside the Pythonista app folder structure.
Therefore check
import sys sys.path
To see if the files you are looking for are actually on this path. Best add a simple test python in the same folder.
-
@cnaeger i just tested and im having zeo problemes runing and programmatically opening external files
-
@cnaeger, your .py file needs to be in the same folder for you to be able to open ”email.txt” with no other path info.
If you want to know what the full path to the file location is, place this script in that location, open and run it there:
import editor print(editor.get_path())
This path you can use to access the files from scripts that are located in e.g. the Pythonista folder structure. Be warned though that Pythonista’s access to the folder can be lost and needs to be re-established, I think at least when installing a beta, maybe even with a regular update.
-
@mikael said:
Be warned though that Pythonista’s access to the folder can be lost and needs to be re-established, I think at least when installing a beta, maybe even with a refular update.
ive never ran a Beta build of Pythonista but when the App does lose my path i laiunchnin
Safe Mode
and it gets restored.