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.
Running scripts saved in iCloud with Shortcuts
holly last edited by
I'm brushing off my rusty python and having a blast with Pythonista. I have a script now that works great when run in Pythonista, but I can figure out how to trigger it from Shortcuts. I've tried all sorts of variations on the path in the "Run Script" block in Shortcuts (the one with the Pythonista icon) and also several variations of urls with the Open URL block. Every time Pythonista says it can't find the file (and, lol, it opens the app with my script loaded behind the dialogue, sigh).
If I write a helloworld in the "This iPhone" folder, no problem. I can call it from Shortcuts and it runs great. But the script I want to run lives in the "iCloud" folder, and I have it under version control and I edit it on several devices, so I don't want to move it if I don't have to. It also reads from and writes to files in its directory, which I want to be able to process in Jupyter later, so I really don't want to have to move all that into the "This iPhone" folder.
I've been googling all day, and I'm down a rabbit hole with the os module trying to maybe import the script from a script in the This iPhone directory and I'm just getting syntax errors because, basically, I'm in territory well above my pay grade, so.. what am I missing? Is there any way to do this?
cvp last edited by cvp
@holly If I correctly understood
holly last edited by
This is excellent! I got a similar (but not quite as thorough) response from another forum and managed to figure it out. My problem was that I was including the
.pyextension in my script name. When I took it out, it worked.
And just for completeness, for anyone else who ends up here with a similar problem, my script is inside a directory in iCloud, so I also included the directory name, so:
Merci, @cvp !
cvp last edited by
@holly Sorry but as my iPad is in French, some "print screens" show french texts like this "ouvrir url" in Shortcuts app.
But Google Translate is our friend 😀