Our program does these kinds of operations hundreds of times for many different variables and lists, then uses them throughout the program:
variable = values[5]
The list values are coming from the command line, often as words, paragraphs, rows of a table or other (it's not important). Our issue is that our program, which is designed to run in a continuous loop, stops when there is an index out of range error. Since this comes from the command line, we can expect these fairly often, but cannot accept our program stopping.
Thus, the question is: How can I catch all index out of range errors in python so that my program does not stop. Do I have to use try/except statements everywhere I make the above type statements (which is a lot of extra work for 40k lines of code) or can I do a catch all somehow? How the error is handled is important (I expect 99% of the time we can set it to NULL, ERROR or 0), but keeping the loop running is even more important.
The list values are coming from the command line, often as words, paragraphs, rows of a table or other (it's not important).
Why not just validate all your input data somehow, once, when you load the program? Am I missing something about this?