IndexError: Cannot choose from an empty sequence
See original GitHub issueDescription of issue / feature request
File "/media/jawahar/jon1/new_project/bm/testDev/lib/python3.6/site-packages/locust/core.py", line 268, in run
self.schedule_task(self.get_next_task())
File "/media/jawahar/jon1/new_project/bm/testDev/lib/python3.6/site-packages/locust/core.py", line 329, in get_next_task
return random.choice(self.tasks)
File "/media/jawahar/jon1/new_project/bm/testDev/lib/python3.6/random.py", line 258, in choice
raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence
Repeately i am getting this error after Start swarming
number of users.
Expected behavior
No Error related to this.
Actual behavior
Traceback showed about
Environment settings (for bug reports)
- OS:Ubuntu 17
- Python version: 3.6.5
- Locust version: 0.8.0/0.8.1
Steps to reproduce (for bug reports)
Run some api and you will get this error
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
IndexError: Cannot choose from an empty sequence
I am trying to run this command python run.py --mode MLE and got this error. I am not able to find the correct...
Read more >IndexError: Cannot choose from an empty sequence
I am getting the following error while loading data into the dataloader. why the data loader is unable to load all images and...
Read more >Python error IndexError Cannot choose from an empty sequence
Your file name seems to be random. Random is a module and can not be used as a file name. Change the filename...
Read more >IndexError: Cannot choose from an empty sequenceraise ...
IndexError: Cannot choose from an empty sequenceraise IndexError (' Cannot choose from an empty sequence ') from None , solved in Python.
Read more >Probability Calculator - IndexError: Cannot choose from an ...
This test uses a hat with 19 balls and tries to draw 20. Your code in your draw method does move everything from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
if you write an invalid locustfile and don’t declare tasks, expect things to break. As I said previously, the error message could be improved.
@jawahar273, That exception gets raised when there are no tasks defined. Can you verify you actually declared some tasks in your locustfile? (either use the
@tasks
decorator or define a class that inherits fromTaskSet
)for Locust devs, A nice enhancement would be to catch the
IndexError
in/locust/core.py
and raise aRuntimeError
instead… It should display an intuitive message like “No tasks defined in locustfile”, and then exit.