my problem is that i am trying to use locust for the first time and i copied the basic code from their website https://docs.locust.io/en/stable/quickstart.html
this is the code that they have given
from locust import HttpUser, task, between
import random
class WebsiteUser(HttpUser):
wait_time = between(5, 9)
@task(2)
def index(self):
self.client.get("/")
self.client.get("/ajax-notifications/")
@task(1)
def view_post(self):
post_id = random.randint(1, 10000)
self.client.get("/post?id=%i" % post_id, name="/post?id=[post-id]")
def on_start(self):
""" on_start is called when a User starts before any task is scheduled """
self.login()
def login(self):
self.client.post("/login", {"username":"ellen_key", "password":"education"})
This is the path to my locustfile.py
E:\work\wipro\work\locust_training\locustfile.py
To run the locustfile.py i type locust in terminal
E:\work\wipro\work\locust_training>locust
The error that it throws is
[2020-05-23 14:44:25,916] DESKTOP-LQ261OQ/INFO/locust.main: Starting web monitor at http://:8089
Traceback (most recent call last):
File "e:\setup\python\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "e:\setup\python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "E:\setup\python\Scripts\locust.exe\__main__.py", line 9, in <module>
File "e:\setup\python\lib\site-packages\locust\main.py", line 236, in main
web_ui = environment.create_web_ui(
File "e:\setup\python\lib\site-packages\locust\env.py", line 144, in create_web_ui
self.web_ui = WebUI(self, host, port, auth_credentials=auth_credentials, tls_cert=tls_cert, tls_key=tls_key)
File "e:\setup\python\lib\site-packages\locust\web.py", line 79, in __init__
app = Flask(__name__)
File "e:\setup\python\lib\site-packages\flask\app.py", line 558, in __init__
self.add_url_rule(
File "e:\setup\python\lib\site-packages\flask\app.py", line 66, in wrapper_func
return f(self, *args, **kwargs)
File "e:\setup\python\lib\site-packages\flask\app.py", line 1216, in add_url_rule
self.url_map.add(rule)
File "e:\setup\python\lib\site-packages\werkzeug\routing.py", line 1562, in add
rule.bind(self)
File "e:\setup\python\lib\site-packages\werkzeug\routing.py", line 711, in bind
self.compile()
File "e:\setup\python\lib\site-packages\werkzeug\routing.py", line 767, in compile
self._build = self._compile_builder(False)
File "e:\setup\python\lib\site-packages\werkzeug\routing.py", line 1128, in _compile_builder
return self.BuilderCompiler(self).compile(append_unknown)
File "e:\setup\python\lib\site-packages\werkzeug\routing.py", line 1119, in compile
co = types.CodeType(*code_args)
TypeError: code() takes at least 14 arguments (13 given)
I searched for the same but was not able to find any specific solution I even tried to copy any locust code i was able to find but that was also not helpful as in one way or other either this error came or some other
Can anyone help with this
What should I do next
Any help will be appreciated
And Thanks in Advance