question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IndexError: list index out of range

See original GitHub issue

I’m trying to run the demo browsing the locust docs and I’m getting this error:

[2014-06-19 16:43:47,263] axc.local/ERROR/stderr: Traceback (most recent call last):
  File ".../lib/python2.7/site-packages/locust/core.py", line 267, in run
    self.execute_next_task()
  File ".../lib/python2.7/site-packages/locust/core.py", line 293, in execute_next_task
    self.execute_task(task["callable"], *task["args"], **task["kwargs"])
  File ".../lib/python2.7/site-packages/locust/core.py", line 305, in execute_task
    task(self, *args, **kwargs)
  File ".../locustfile.py", line 33, in load_sub_page
    url = random.choice(self.urls_on_current_page)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 274, in choice
    return seq[int(self.random() * len(seq))]  # raises IndexError if seq is empty
IndexError: list index out of range

and at the end I get this error report:

GET /en/latest//: 'ConnectionError(MaxRetryError("HTTPConnectionPool(host=\'docs.locust.io\', port=80): Max retries exceeded with url: /en/latest// (Caused by <class \'socket.gaierror\'>: [Errno 8] nodename nor servname provided, or not known)",),)'
GET /en/latest/writing-a-locustfile.html: 'ConnectionError(MaxRetryError("HTTPConnectionPool(host=\'docs.locust.io\', port=80): Max retries exceeded with url: /en/latest/writing-a-locustfile.html (Caused by <class \'socket.gaierror\'>: [Errno 8] nodename nor servname provided, or not known)",),)'

It keeps stuck after the first error doing nothing, if I redirect the url to a custom site and check the logs, as soon as the error gets in locusts stops making requests.

I’m using a usual virtualenv with python 2.7 and packages installed by pip.

Thanks.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
msert29commented, Sep 27, 2017

I think you guys need to specify the on_start method and check that you have configured the task decorator before task methods.

1reaction
whgibbocommented, Jun 15, 2015

I’m having the same issue, what was the solution ? Forget I solved it, I was using on_start rather than defining tasks 😦 Sorry

Read more comments on GitHub >

github_iconTop Results From Across the Web

List Index Out of Range – Python Error Message Solved
You'll get the Indexerror: list index out of range error when iterating through a list and trying to access an item that doesn't...
Read more >
Indexerror: list Index Out of Range in Python - STechies
In python “list index out of range” error occurs when we try to access an undefined element from the list. List index out...
Read more >
Index Error: list index out of range (Python) - Stack Overflow
Generally it means that you are providing an index for which a list element does not exist. E.g, if your list was [1,...
Read more >
Python IndexError: List Index Out of Range [Easy Fix] - Finxter
The error “list index out of range” arises if you access invalid indices in your ...
Read more >
How to debug list index out of range error in python? - Flexiple
To foolproof your loop of such instances, the range() function along with len() would return the length of the list dynamically. Subsequently ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found