I’m trying to run k6 on a python script,
but I’m getting the error:
level=error msg="accepts 1 arg(s), received 2: arg should either be "-", if reading script from stdin, or a path to a script file
Could it be that k6 can’t run Python scripts?
Also is there a way to import k6 tool to python script?
Welcome to the community forum
Is this stackoverflow question the same? Is that why you would be looking into importing the k6 tool to a python script, you have the data/functions for the test already in python?
I am not an expert in python, though it seems you could be looking at running k6 from python. If the k6 binary is available in the command line you could run the
k6 executable with parameters. Which is not ideal and might not even be enough depending on your case: you would need to inject data via environment variables/shared files, etc.
There are some things we can control using the k6 REST API, though it requires a k6 already running, and would be limited for your needs. We can mostly control the test execution, e.g. to build a UI: Building a UI for the k6 load testing tool