Python Forum
IndexError: tuple index out of range ? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: IndexError: tuple index out of range ? (/thread-23850.html)



IndexError: tuple index out of range ? - JohnnyCoffee - Jan-20-2020

I have a perfectly functioning code that accesses certain array indexes with problems!

The following message appears in the terminal: IndexError: tuple index out of range?

What would that error be?


RE: IndexError: tuple index out of range ? - Marbelous - Jan-20-2020

Just like the error says, you're trying to access an element in a tuple with an index that is out of its range. Can't say more without seeing the code...


RE: IndexError: tuple index out of range ? - michael1789 - Jan-20-2020

If you post the code and the error it should be easy to spot. When python indexes it starts a 0 not 1. So, if you have eg range(5) it is indexed as "0, 1, 2, 3, 4". That's usually the issue.


RE: IndexError: tuple index out of range ? - buran - Jan-20-2020

(Jan-20-2020, 05:06 PM)JohnnyCoffee Wrote: I have a perfectly functioning code that accesses certain array indexes with problems!
you understand the inherent contradiction in this statement, right? :-)
post the code in python tags, the full traceback - in error tags.


RE: IndexError: tuple index out of range ? - JohnnyCoffee - Jan-22-2020

it was a silly mistake already solved, grateful for the help.