Forum Archive

Pythonista “Run script” action in Automator

kenficara

In Automator there is now a Pythonista “Run script” action that takes “The name of the script to be run” as its argument. I have tried the name of the script, the Pythonista URL for the script, a fully qualified iCloud path, etc etc etc. Nothing works. If I want to run a Pythonista script “this_folder/foo.py” what do I enter as an argument for the action?

cvp

@kenficara try

MyScript.py?action=run
kenficara

Thanks, @cvp — I tried that, with or without the query string. I also tried adding root=icloud since that’s where the script is. I tried it prefixed with pythonista:/// per the docs, prefixed with a leading slash, and prefixed with nothing as you show above.

The script is in an iCloud folder, so I’ve tried:

/folder/script.py?action=run&root=icloud

folder/script.py?action=run&root=icloud

pythonista3:///folder/script.py?action=run&root=icloud

cvp

@kenficara Sorry, as I don’t use Automator, I can’t help.

JonB

ICloud folders are funny, and not a subfolder of pythonista.

Try having a script in the main path, which you can then use cd or sys.path.insert to add the iCloud path, and maybe runpy or import, etc.

cvp

@kenficara As I said, I don't know Automator but I guess it could run a shortcut (of the Shortcuts app) and this shortcut could open an url running a Pythonista script via its url scheme.