Forum Archive

Sending arguments from Shortcuts to Pythonista not working

michaelmincone

https://imgur.com/a/aYvbSLC

Does anyone have an idea as to why this isn't working and how I can fix it? Any help is greatly appreciated

ccc

On the leftmost panel, should "Hello" be in quotes?

cvp

@ccc Same problem with "Hello"

cvp

Workaround, your shortcut could be

URL = pythonista3://test.py?action=run&args=Hello 
Open URL

and that works as expected

shiranc

I am experiencing the same problem.
When using the URL workaround, is there a limitation to the size of the argument?

cvp

@shiranc I don't see why it could be a limit but don't forget this is an url...

shiranc

Thanks! @cvp

msperlin

I’m trying to pass a list of arguments (which worked before iOS 13). How would I do this with a URL?

My list looks like this:

A=Hello
B=foo

Pythonista would see sys.argv(1) = “A=Hello”. Sys.argv(2)=“B=foo”

Any ideas?

cvp

@msperlin see the doc in the App (console / ? / using Pythonista / url scheme)

pythonista://MyScript?action=run&args=foo%20bar 

When you pass a single string with the args URL parameter, the string is split by spaces (the space is encoded as %20 here) and sys.argv would be [, 'foo', 'bar'] in this example.

a.idy

Hi,

Does anyone know why we need a workaround? Did the recent new version of iOS break Shortcuts being able to run Pythonista scripts directly?