Passing arguments with spaces in Run options
Under the wrench icon in Pythonista there is a “Run options” button with an input field to add arguments. If I enter “first argument”, “second argument” into that field, argv will contain [“first”, “argument”, “second”, “argument”]. How does one pass arguments with spaces here?
https://docs.python.org/3/library/urllib.parse.html#url-quoting contains the general idea.
s.replace(" ", "+")and if that does not work, try
s.replace(" ", "%20").
@kenficara see local doc
Example: 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 [<script_path>, 'foo', 'bar'] in this example. If you want to pass arguments that contain spaces, you have to enclose them in double quotes (as you would in a classic shell). This is basically the same as running a script by long-pressing the run button.
This post is deleted!last edited by