Button press event - event handling and picking: IndexError: list index out of range

MRAB python at mrabarnett.plus.com
Sun Jun 7 18:38:02 EDT 2020


On 2020-06-07 23:24, DL Neil via Python-list wrote:
> On 8/06/20 7:06 AM, Caledonian26 wrote:
> ...
> 
>> However, I keep getting the error: IndexError: list index out of range. Could anyone give me a helping hand as to where I am going wrong?
> 
> 
> When things go wrong, Python tries to be helpful by providing a
> "traceback". Please copy-paste the entire traceback, to help us help you.
> 
> The error-message says that (somewhere) a list is being used *but* the
> index is pointing to an element that does not exist, eg the fifth
> element of a list that contains only three members.
> 
> Short answer: What you could do, is add a temporary print() to show you
> the exact value of the list index. Thus, giving you a pointer/where to
> back-track, to find the source of the problem...
> 
> The longer answer: learning to use a debugger or a 'visual' IDE/web-tool.
> 
FYI, that's the same good advice that ChrisA gave yesterday in reply to 
the same post. See the thread "Applied Data Science with Python - 
Assignment 2.3: clicking on chart to select Y values".


More information about the Python-list mailing list