Python Forum
IndexError: list index out of range bug?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IndexError: list index out of range bug?
#4
I can't see where you are incrementing rownum, you haven't shown that code,
but as I previously stated, it most likely has to do with index starting at zero.
thus if you keep incrementing rownum, at some point it will be equal to length of frame + 1, thus returning an index error.
if you surround your code with:
try:
    ... your code here ...
except IndexError:
    print(f"Index error, rownum: {rownum}")
    raise
this will show what rownum is equal to when the index error occurs.
Also, you should always post your error tracebacks, complete and untouched as they almost certainly pinpoint the cause of error.
(Use error tags)
Reply


Messages In This Thread
RE: IndexError: list index out of range bug? - by Larz60+ - Oct-18-2019, 11:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  removing one list element without using its index paul18fr 7 1,272 Feb-22-2025, 07:59 PM
Last Post: DeaD_EyE
  IndexError: index 31 is out of bounds for axis 0 with size 31 YL789 1 923 Sep-21-2024, 09:46 AM
Last Post: Gribouillis
  IndexError: index 10 is out of bounds for axis 0 with size 10 Mehboob 11 10,284 Sep-14-2023, 06:54 AM
Last Post: Mehboob
Thumbs Down I hate "List index out of range" Melen 20 9,483 May-14-2023, 06:43 AM
Last Post: deanhystad
Exclamation IndexError: Replacement index 2 out of range for positional args tuple - help? MrKnd94 2 13,947 Oct-14-2022, 09:57 PM
Last Post: MrKnd94
  IndexError: list index out of range dolac 4 3,424 Jul-25-2022, 03:42 PM
Last Post: deanhystad
  I'm getting a String index out of range error debian77 7 3,937 Jun-26-2022, 09:50 AM
Last Post: deanhystad
  IndexError: list index out of range Anldra12 2 2,251 May-03-2022, 01:39 PM
Last Post: Anldra12
  TypeError: list indices must be integers or slices, not range Anldra12 2 4,535 Apr-22-2022, 10:56 AM
Last Post: Anldra12
  matplotlib x axis range goes over the set range Pedroski55 5 6,664 Nov-21-2021, 08:40 AM
Last Post: paul18fr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020