Shortcuts can't find Pythonista script on "iCloud", only on "This iPhone"

I’ve been working on my first Pythonista script and the script itself is working great (yay!), I can call a shortcut from it (thanks to help from this forum Can I call a shortcut from pythonista? ), but I also want to call the script from a Shortcut and that is not working.

I have the Pythonista script in iCloud because it’s reading from and writing to iCloud files in the directory with it (and it works when run from the Pythonista app so Pythonista is happy with it there), but if I use the “Run Script” command in Shortcuts, Shortcuts it tells me it can’t find the script. If I create a hello world in the “This iPhone” directory instead, Shortcuts can find and run it with no problem.

So, I need to figure out how to do one of two things, either:

1.) tell Shortcuts how to find my script in iCloud (I’ve tried several variations on the path to the file, but no luck yet)

or

2.) move my pythonista script to “This iPhone”, and figure out what path to give the script to reference back to the iCloud files it wants to read and write with. This is definitely not the preferred option since the iCloud directory the script is currently in is under git control, and I’m not sure how to put a “This iPhone” directory under git control.

Do you use &root=icloud in your URL?

That’s what I needed to add to run Pythonista scripts from Launch Center Pro, when I moved them to iCloud.

I wasn’t using the url block, I’m using the pythonista “run script” one. (images below)

I’ll try using the url one, but it seems like there should be a way with the pythonista one?

I can’t seem to make it work using a url. Maybe I’m constructing the url wrong? Neither of these work:

pythonista://mydir/myfile.py&root=iCloud

pythonista://myfile.py&root=iCloud/mydir

It just reports it can’t find the file in both cases.

This is what I use in LCP to run the script rtm.py which is stored in iCloud:

pythonista://rtm?action=run&root=icloud&argv=...

1 Like

omg that worked. It seems like the trick was not putting the .py in. Thank you!!!

1 Like