What to do to correct the error written below:
Peter Pearson
pkpearson at nowhere.invalid
Sun Apr 10 10:32:10 EDT 2022
On Sat, 9 Apr 2022 04:59:05 -0700 (PDT), NArshad <narshad.380 at gmail.com> wrote:
> I have accidentally deleted one account in a Django project because of
> which one of the pages is no more accessible and is giving the error
> written below:
>
> IndexError at /view_issued_book/
> list index out of range
>
> and the error is in the line:
>
> t=(students[i].user,students[i].user_id,books[i].name,books[i].isbn,issuedBooks[0].issued_date,issuedBooks[0].expiry_date,fine)
[snip]
Without seeing more of the code, one can only guess, but it appears
that the data being processed reside in arrays named "students" and "books",
which are indexed by an integer i. The "list index out of range" error
probably results from i being too large -- running off the end of the
array, perhaps because of the deleted account. You could confirm this
by printing i, len(students), and len(books) just before the failing
line.
--
To email me, substitute nowhere->runbox, invalid->com.
More information about the Python-list
mailing list