Skip to content
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

Module object is not callable in locust 0.13.0 #1438

Closed
Fatahir opened this issue Jun 18, 2020 · 1 comment
Closed

Module object is not callable in locust 0.13.0 #1438

Fatahir opened this issue Jun 18, 2020 · 1 comment
Labels

Comments

@Fatahir
Copy link

Fatahir commented Jun 18, 2020

when i run locust -f /Desktop/locust_file.py following error occurs

[2020-06-18 12:09:27,858] fatima/INFO/locust.main: Starting web monitor at *:8089
[2020-06-18 12:09:27,858] fatima/ERROR/stderr: Traceback (most recent call last):
[2020-06-18 12:09:27,858] fatima/ERROR/stderr: File "/home/fatima/.local/bin/locust", line 11, in <module>
[2020-06-18 12:09:27,858] fatima/ERROR/stderr: 
[2020-06-18 12:09:27,858] fatima/ERROR/stderr: sys.exit(main())
[2020-06-18 12:09:27,858] fatima/ERROR/stderr: File "/home/fatima/.local/lib/python2.7/site-packages/locust/main.py", line 525, in main
[2020-06-18 12:09:27,858] fatima/ERROR/stderr: 
[2020-06-18 12:09:27,858] fatima/ERROR/stderr: gevent.signal(signal.SIGTERM, sig_term_handler)
[2020-06-18 12:09:27,859] fatima/ERROR/stderr: TypeError
[2020-06-18 12:09:27,859] fatima/ERROR/stderr: :
[2020-06-18 12:09:27,859] fatima/ERROR/stderr: 'module' object is not callable
[2020-06-18 12:09:27,859] fatima/ERROR/stderr: 

i am using python version :3.7
locust 0.13.0
and here is the code

import random
from locust import HttpLocust, TaskSet, between

products = [
    '0PUK6V6EV0',
    '1YMWWN1N4O',
    '2ZYFJ3GM2N',
    '66VCHSJNUP',
    '6E92ZMYYFZ',
    '9SIQT8TOJO',
    'L9ECAV7KIM',
    'LS4PSXUNUM',
    'OLJCESPC7Z']

def index(l):
    l.client.get("/")

def setCurrency(l):
    currencies = ['EUR', 'USD', 'JPY', 'CAD']
    l.client.post("/setCurrency",
        {'currency_code': random.choice(currencies)})

def browseProduct(l):
    l.client.get("/product/" + random.choice(products))

class UserBehavior(TaskSet):

    def on_start(self):
        index(self)

    tasks = {index: 1,
        setCurrency: 2,
        browseProduct: 10,
        }

class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    wait_time = between(1, 10)
@heyman
Copy link
Member

heyman commented Jun 18, 2020

I believe this could be fixed by either downgrading or upgrading the version of gevent (probably downgrading). So you could try that, or even better upgrade to Locust >1.0 (locust package on PyPI) or at least 0.14.6 (locustio package on PyPI).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants