-1

What am I doing wrong here? My Click script has no arguments but has multiple options. My script is as follows:

@click.command()
@click.option("--error-percent-threshold")
@click.option("--latency-threshold")
@click.option("--node-type")
@click.option("--master-ip", default="0.0.0.0")
def main(node_type, error_percent_threshold, latency_threshold, master_ip):
    """Something"""

if __name__ == '__main__':
    main()

Now when I run my script with python3 script.py --node-type=master --latency-threshold=50 --error-percent-threshold=1 I get the following error:

error: unrecognized arguments: --node-type=master --latency-threshold=50 --error-percent-threshold=1

Why is Click confusing my options as arguments?

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
streetsoldier
  • 1,259
  • 1
  • 14
  • 32

1 Answers1

0

So it wasn't Click after all. It was what I was doing in the script. I was trying to spin up Locust UI programatically. The args got parsed correctly but they were being passed to locust for some reason and locust was the one error out with the unrecognized args error. I was able to get around this with a sys.argv = [sys.argv[0]] right before I start working with locust in the script.

streetsoldier
  • 1,259
  • 1
  • 14
  • 32