iOS 15 - unable to open a file for writing
I am working on a iPad that I have updated to iOS15 and am not able to open a file for writing anymore. quick test was with YouTube-dl. I get the error "unable to open for writing: [Errno 1] Operations not permitted: (then the title of the video)
Hi, thanks for reaching out. The short (most likely) explanation is that you are in a directory where you don't have writing permission (probably "/"). Type "cd" or "cd ~shortcuts" before the download (or "pwd" to check where you are).
The long explanation is that, after an update (either of the system or the App), the home directory of the App changes. a-Shell stores the directory where you were last before you left, and tries to go back to this directory. It fails when that directory does not exist anymore. In the latest TestFlight version (soon to become the AppStore version), when the directory does not exist we go to "~/Documents", which is more reasonable than doing nothing.
I have have tried that and it appear in the shell the directory is there. I can create directories and everything, but when I look in finder it is not there. Odd bug for sure as now I can create a file (with your-dl as in my previous example) but the folder is no where to be found in files. I will continue to look.
I created a directory with the same name (I was able to) and then rebooted the iPad. both directories seem to exist again. I am going to delete the dir with the same name (Change the name first) and see what happens.
Thanks for the help
Shortcuts are running in a separate directory (~shortcuts or $SHORTCUTS), which is not visible from the Files app. It's possible that a-Shell is running in this directory instead of $HOME, which would explain the behaviour you describe.
What does pwd say?
/private/var/mobile/Containers/Data/Application/UUID(long random)/Documents
Okay, so that's ~/Documents (~shortcuts would have .../AppGroup/...).
So none of that should happen. I am running out of rational explanations for this behaviour.
I just tested on a iPad with iPadOS 15, and I was able to create a directory and a file, and they appeared in the Files App.
I will keep testing but it is working again, so that is cool. thanks for trying it out and great product BTW!
problem might be in the way how you use youtube-dl (or, in 2023 - yt-dlp) parameter for the output.
-o defines the path WITH filename (e.g. ~/Documents/video.mp4)
-P defines path only (e.g. ~/Documents/)
so in apple shortcuts, following command works for me
yt-dlp url --format mp4 -P ~/Documents/