我正在尝试蝗虫tutorial。
尝试运行Objects/dictobject.c:1439: bad argument to internal function
时出现错误locust -f locustfile.py --host=http://localhost:8080
。
服务器已在运行。
错误摘要:
...
[2018-07-25 08:55:06,330] CRMs-iMac/INFO/locust.main: Starting web monitor at *:8089
[2018-07-25 08:55:06,330] CRMs-iMac/ERROR/stderr: Traceback (most recent call last):
[2018-07-25 08:55:06,330] CRMs-iMac/ERROR/stderr: File "/Users/crmonlinegraph/.virtualenvs/venvpy3.7/bin/locust", line 11, in <module>
[2018-07-25 08:55:06,331] CRMs-iMac/ERROR/stderr:
[2018-07-25 08:55:06,331] CRMs-iMac/ERROR/stderr: sys.exit(main())
[2018-07-25 08:55:06,331] CRMs-iMac/ERROR/stderr:
[2018-07-25 08:55:06,331] CRMs-iMac/ERROR/stderr: File "/Users/crmonlinegraph/.virtualenvs/venvpy3.7/lib/python3.7/site-packages/locust/main.py", line 430, in main
[2018-07-25 08:55:06,331] CRMs-iMac/ERROR/stderr:
[2018-07-25 08:55:06,331] CRMs-iMac/ERROR/stderr: main_greenlet = gevent.spawn(web.start, locust_classes, options)
[2018-07-25 08:55:06,331] CRMs-iMac/ERROR/stderr:
[2018-07-25 08:55:06,331] CRMs-iMac/ERROR/stderr: File "src/gevent/greenlet.py", line 538, in gevent._greenlet.Greenlet.spawn
[2018-07-25 08:55:06,332] CRMs-iMac/ERROR/stderr: File "src/gevent/greenlet.py", line 213, in gevent._greenlet.Greenlet.__init__
[2018-07-25 08:55:06,332] CRMs-iMac/ERROR/stderr: File "src/gevent/_hub_local.py", line 80, in gevent.__hub_local.get_hub_noargs
[2018-07-25 08:55:06,332] CRMs-iMac/ERROR/stderr: File "/Users/crmonlinegraph/.virtualenvs/venvpy3.7/lib/python3.7/site-packages/gevent/hub.py", line 390, in __init__
[2018-07-25 08:55:06,332] CRMs-iMac/ERROR/stderr:
[2018-07-25 08:55:06,332] CRMs-iMac/ERROR/stderr: WaitOperationsGreenlet.__init__(self, None, None)
[2018-07-25 08:55:06,332] CRMs-iMac/ERROR/stderr:
[2018-07-25 08:55:06,333] CRMs-iMac/ERROR/stderr: File "src/gevent/_greenlet_primitives.py", line 42, in gevent.__greenlet_primitives.TrackedRawGreenlet.__init__
[2018-07-25 08:55:06,333] CRMs-iMac/ERROR/stderr: SystemError
[2018-07-25 08:55:06,333] CRMs-iMac/ERROR/stderr: :
[2018-07-25 08:55:06,333] CRMs-iMac/ERROR/stderr: Objects/dictobject.c:1439: bad argument to internal function
[2018-07-25 08:55:06,333] CRMs-iMac/ERROR/stderr:
locustfile.py:
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
""" on_start is called when a Locust start before any task is scheduled """
self.login()
def on_stop(self):
""" on_stop is called when the TaskSet is stopping """
self.logout()
def login(self):
self.client.post("/login", {"username":"ellen_key", "password":"education"})
def logout(self):
self.client.post("/logout", {"username":"ellen_key", "password":"education"})
@task(2)
def index(self):
self.client.get("/")
@task(1)
def profile(self):
self.client.get("/profile")
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 5000
max_wait = 9000
唯一的dictobject
将是{"username":"ellen_key", "password":"education"}
。有什么想法吗?