I found the problem: the exception "Index out of range" I get is an internal Exception raised by Python internal code. This is normally caught by the code and the user is not aware of it except if you select the checkbox Raised Exceptions below the section Breakpoints in VsCode. In this case all the exceptions will be shown to the user, and not only the Uncaught ones (which is the default setting). Sneaky.