-
-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG/FEATURE REQUEST: "Param" does not support spaces #758
Comments
What if you invoke it as "--extra_label=LabelB"?
Shell convention says that long-name arguments should have their values set
with =, and short-name arguments assign from the value following the
argument.
…On Fri, Aug 9, 2024, 1:57 PM Lionel Zhang ***@***.***> wrote:
Script config in UI:
image.png (view on web)
<https://github.com/user-attachments/assets/7d4f9fd7-3f36-4e2b-a352-ddf9ce16b15c>
The test script:
from argparse import ArgumentParser
def parse_args():
parser = ArgumentParser()
parser.add_argument("--extra_label", nargs=2, action="append", metavar=("LABEL_NAME", "LABEL_VALUE"))
return parser.parse_args()
args = parse_args()
print(args.extra_label)
Output error:
image.png (view on web)
<https://github.com/user-attachments/assets/ec9748f3-e452-4496-b037-32c260c10bd0>
When I copy paste the command that was supposed run in the "HISTORY" menu,
it runs successfully:
image.png (view on web)
<https://github.com/user-attachments/assets/f6018e28-5f99-43df-8a47-8b87322c7f1b>
------------------------------
The suspected reason for error, is that there can't be spaces in the
command ("result"). E.g. when I added the two lines that are commented
below, it would work.
image.png (view on web)
<https://github.com/user-attachments/assets/4277cd75-288d-4cbf-8bc6-32363836a832>
—
Reply to this email directly, view it on GitHub
<#758>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3HBI3VLSRL6GBKIYGBPKNLZQT7JRAVCNFSM6AAAAABMI4RILSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2TQNBQGY3TEMI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi @0lionelzhang0, it's supposed to work this way. Everything is sent to scripts as isolated arguments, i.e. effectively the same as being wrapped in quotes, e.g. @MNeill73 from what I know, argparse won't work with this syntax. Thanks for the suggestion though! |
Thank you for getting back to me so quickly! I understand that this behavior is expected based on the implementation. It was just a little unintuitive and frustrating when trying to debug, since the command shown in the "HISTORY" and log files doesn't reflect the "invisible" single-quotes that the backend executes the command with. |
Script config in UI:
The test script:
Output error:
When I copy paste the command that was supposed run in the "HISTORY" menu, it runs successfully:
The suspected reason for error, is that there can't be spaces in the command ("result"). E.g. when I added the two lines that are commented below, it would work (and commenting out the original append option_name line).
The text was updated successfully, but these errors were encountered: